ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Shadel <shade...@mtc.byu.edu>
Subject RE: Property Replacement and Custom Tasks
Date Wed, 03 Oct 2001 22:41:29 GMT
I've even noticed a difference between a couple built-in tasks.  <property> replaces
${}'s when loaded from a file, but <filter> does NOT.  Both DO replace ${}'s when a
single one is defined in the build.xml.  With this case it seemed to be that the <filter>
code just chose not to call the <project> function to replace ${}'s with property values...
 I don't know why that was, and maybe your case is similar - a programmer's choice that may
have a reason, but it's not readily apparent.

Tim

>>> kkusumoto@learningframework.com 10/03/01 12:46PM >>>
I looked into that a little, but I don't know the code well enough to know.
One thing I did see was that
org.apache.tools.ant.ProjectHelper.NestedElementHandler.init() was handling
'param' differently depending on whether it is the built-in task or the
custom task.

Kris

> -----Original Message-----
> From: Diane Holt [mailto:holtdl@yahoo.com] 
> Sent: Wednesday, October 03, 2001 10:41 AM
> To: ant-user@jakarta.apache.org 
> Subject: Re: Property Replacement and Custom Tasks
> 
> 
> Not sure, but you might want to look thru the changes that 
> implemented the
> new "inheritAll" attribute for <ant>/<antcall>.
> 
> Diane
> 
> --- "Kusumoto, Kris" <kkusumoto@learningframework.com> wrote:
> > After upgrading from 1.2 to 1.4 one of my custom tasks quit 
> working. 
> > After some testing, I narrowed the problem down to an unexpected
> > difference in property replacement between built-in tasks vs. custom
> > tasks.
> > 
> > The build.xml below is a minimal example which doesn't use my custom
> > task but still illustrates the issue.  The custom task 
> 'testcall' maps
> > to Ant's CallTarget (i.e. antcall).  I would expect both calls to
> > the 'test' target to operate the same, but they don't.  Am 
> I mis-using
> > property replacement?
> > 
> > Kris
> > 
> > BUILD.XML
> > ---------------------------------------------------------------
> > <project name="unused" default="all" basedir=".">
> > 
> >    <target name="all">
> >      <property name="bad" value="good" />
> >      <taskdef name="testcall"
> > classname="org.apache.tools.ant.taskdefs.CallTarget" />
> >      <antcall target="test">
> >         <param name="arg" value="${bad}" />
> >      </antcall>
> >      <testcall target="test">
> >         <param name="arg" value="${bad}" />
> >      </testcall>
> >    </target>
> > 
> >    <target name="test">
> >       <echo message="test is ${arg}" />
> >    </target>
> > 
> > </project>
> > 
> > OUTPUT
> > ----------------------------------------------------------------
> > Buildfile: build.xml
> > 
> > all:
> > 
> > test:
> >      [echo] test is good
> > 
> > test:
> >      [echo] test is ${bad}
> > 
> > BUILD SUCCESSFUL
> > 
> > Total time: 0 seconds
> 
> 
> =====
> (holtdl@yahoo.com)
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Listen to your Yahoo! Mail messages from any phone.
> http://phone.yahoo.com 
> 


Mime
View raw message