ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: Manual verbiage: calling vs dependency
Date Wed, 01 Oct 2003 05:25:42 GMT
Main reason for "depends" is: ant is not a scripting language.
Never designed for that.
A buildfile should describe the build process and its "dependencies".

Another "side-effect" is that a dependend target is only executed once.


<target name="main" depends="one,two"/>
<target name="one" depends="common"/>
<target name="two" depends="common"/>
<target name="common"/>

--> common is executed once (when "ant main")
    when "ant one two" the common is executed twice (should that be???)


<target name="main" depends="one,two"/>
<target name="one"><antcall target="common"/></target>
<target name="two"><antcall target="common"/></target>
<target name="common"/>

--> common is executed twice


Jan


> -----Original Message-----
> From: Jack J. Woehr [mailto:jax@purematrix.com]
> Sent: Tuesday, September 30, 2003 11:06 PM
> To: Ant Users List
> Subject: Manual verbiage: calling vs dependency
> 
> 
> May I suggest the following verbiage for somewhere in the Ant 
> manual? I had trouble with
> this concept and it seems a lot of newbies do also.
> 
>  Calling versus Dependency
> 
>     Whenever you call into an Ant target via <antcall> or 
> <ant>, any changes (e.g., setting properties)
>     by the called target do not propagate back into the 
> caller's environment. This is the reason targets
>     which are the main line of an overall build tend to be 
> referenced via the "depends" attribute, because
>     changes to the environment (e.g., setting properties) by 
> a target referenced as a depend *do* modify
>     the dependent target's environment.
> 
>     Example:
> 
>     <target  name="foo">
>         <property name="woof" value="Bow-wow"/>
>     </target>
> 
>     <!-- says "Bow-wow" -->
>     <target name="bar" depends="foo">
>         <echo message="${woof}"/>
>     </target>
> 
>     <!-- says "${woof}" of course, uninstanced variable -->
>     <target name="surprise">
>         <antcall target="bar">
>         <echo message="${woof}"/>
>     </target>
> 
> --
> Jack J. Woehr      # You measure democracy by the freedom it
> Senior Consultant  # gives its dissidents, not the freedom
> Purematrix, Inc.   # it gives its assimilated conformists.
> www.purematrix.com #         - Abbie Hoffman
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message