ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack J. Woehr" <...@purematrix.com>
Subject Manual verbiage: calling vs dependency
Date Tue, 30 Sep 2003 21:06:25 GMT
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
View raw message