ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stuart Halloway" <...@develop.com>
Subject RE: Property propagation?
Date Wed, 25 Oct 2000 21:22:40 GMT
Hi Glenn, Diane:

Thanks.  I concur with your suggestions, and in fact was already using both.
My concern was that the docs do not clearly state that this code will work
and that it might be an accident of the current implementation.

wrt passing properties: the docs imply that they will all be passed
implicitly.  The ant task docs say "The properties of the current project
will be available in the new project."  Maybe should be changed to say "are
available and can be passed to..."

wrt executing tasks in a particular order: "Ant tries to execute the targets
in the depends attribute in the order they appear" didn't sound like a
strong guarantee.  Perhaps it should read "Ant _will_ execute the targets in
the order they appear, _unless_ other dependencies force a different order."

Of course, I am now about to download 1.2 and find that I am worrying about
docs that have already changed anyway... ;-)

Stuart Halloway
DevelopMentor
http://staff.develop.com/halloway

> -----Original Message-----
> From: glennm@ca.ibm.com [mailto:glennm@ca.ibm.com]
> Sent: Tuesday, October 24, 2000 11:44 AM
> To: ant-user@jakarta.apache.org
> Subject: Re: Property propagation?
>
>
>
>
> Err... a cleaner way to do what you want is
>
> <project name="test" defalt="all">
>   <target name="all" depends="clean,compile">
>     <echo message="Build complete!" />
>   </target>
>
>   <target name="clean">
>     <delete dir="${build.dir}" />
>   </target>
>
>   <target name="compile">
>     <javac ... />
>   </target>
> </project>
>
> If you do it with <ant> calls, you a simply doubling your memory
> requirements, and probably the time as well.  And Diane is right about how
> to use the nested <property> tag of the <ant> task.  Be aware that in Ant
> 1.2 the resolution of property values occurs at runtime, rather than parse
> time.
>
> Glenn McAllister
> Software Developer. IBM Toronto Lab, (416) 448-3805
> "An approximate answer to the right question is better than the
> right answer to the wrong question." - John W. Tukey
>
>
> Please respond to ant-user@jakarta.apache.org
>
> To:   ant-user@jakarta.apache.org
> cc:
> Subject:  Re: Property propagation?
>
> I might be too sleep-deprived to be answering this correctly, but I think
> you should be including a nested <property> in your <ant> calls, in order
> to pass to the "clean" target's "myprop" the value you want. Ie:
> <ant antfile="test.xml" target="clean">
>   <property name="myprop" value="${myprop}"/>
> </ant>
>
> Diane
>
> --- Stuart Halloway <stu@develop.com> wrote:
> > According to the docs, properties are propagated by the "ant" task, and
> > override any "property" task settings.  I am not finding this to be the
> > case, e.g.
> >
> > <project name="test" default="all" basedir=".">
> >   <target name="clean">
> >     <property name="myprop" value="other" />
> >     <echo message="clean ran, myprop=${myprop}"/>
> >   </target>
> >   <target name="compile">
> >     <echo message="compile ran, myprop=${myprop}"/>
> >   </target>
> >   <target name="all">
> >     <echo message="all ran, myprop=${myprop}"/>
> >     <ant antfile="test.xml" target="clean"/>
> >     <ant antfile="test.xml" target="compile"/>
> >   </target>
> > </project>
> >
> > The idea of this project is that "all" depends on "clean" followed by
> > "compile," BUT "compile" does not depend on "clean."  To make this work,
> > I
> > execute "clean" and "compile" as "ant" tasks under the "all" target.
> >
> > Properties passed on the command line correctly propagate to the ant
> > sub-tasks, but then the "property" task is able to change them.  So,
> > with
> > the command line
> >
> >    ant -buildfile=test.xml -Dmyprop=foo all
> >
> > the "all" task correctly uses the value "foo" but the "clean" task uses
> > the
> > value "other."  As a workaround, I can pass the properties explicitly,
> > like
> > this:
> >
> > <ant antfile="test.xml" target="clean">
> >   <property name="myprop" value="${myprop}" />
> > </ant>
> >
> > Is this an ant bug, a stu bug, or a doc error?  :-)
> >
> > Stuart Halloway
> > DevelopMentor
> > http://staff.develop.com/halloway
> >
>
>
> =====
> (holtdl@yahoo.com)
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Messenger - Talk while you surf!  It's FREE.
> http://im.yahoo.com/
>
>


Mime
View raw message