ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Goktepe" <andrewgokt...@gmail.com>
Subject Re: Am I being a silly - or is there an antcall bug?
Date Mon, 24 Jul 2006 23:12:43 GMT
This is not a bug. Properties that are set during an antcall are not passed
back to the calling target, but properties do go the other direction as the
called target inherits them from its parent. Therefore, when target2 calls
dependency1, run_once_target.done is set, but is lost when control returns
to the calling script. So when target2 then calls dependency2,
run_once_target.done is still undefined again.

Properties that are set during the run of a dependent target do stick
around. This is why the message only appears once when you run target1 and
target3.

If you need properties to return from the called target, you need to write
them to a file and then load them from the calling script.

-Andrew

On 7/24/06, Nick.Minutello@ubs.com <Nick.Minutello@ubs.com> wrote:
>
>  I would expect that when calling all targets below (target1, target2 &
> target3) the "run_once_target" would get called only… once.
>
> However, its not so.
> With "target2", it gets called twice.
> Is that a bug?
>
> Doesn't seem to matter if I set inheritall="true" or not….
>
> ant -version
> Apache Ant version 1.6.5 compiled on June 2 2005
>
> -Nick
>
>
> <project name="moo" default="target1">
>
>     <target name="run_once_target" unless="run_once_target.done">
>         <echo message="## running run_once_target"/>
>         <property name="run_once_target.done" value="true"/>
>     </target>
>     <target name="dependancy1" depends="run_once_target">
>         <echo message="## running dependancy1"/>
>     </target>
>     <target name="dependancy2" depends="run_once_target">
>         <echo message="## running dependancy2"/>
>     </target>
>
>     <target name="target1" depends="dependancy1, dependancy2">
>         <echo message="## running target1"/>
>     </target>
>
>     <target name="target2">
>         <echo message="## running target2"/>
>         <antcall target="dependancy1"/>
>         <antcall target="dependancy2"/>
>     </target>
>
>     <target name="target3" depends="run_once_target">
>         <echo message="## running target3"/>
>         <antcall target="dependancy1"/>
>         <antcall target="dependancy2"/>
>     </target>
> </project>
>
>
> Visit our website at http://www.ubs.com
>
> This message contains confidential information and is intended only
> for the individual named.  If you are not the named addressee you
> should not disseminate, distribute or copy this e-mail.  Please
> notify the sender immediately by e-mail if you have received this
> e-mail by mistake and delete this e-mail from your system.
>
> E-mail transmission cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses.  The sender therefore
> does not accept liability for any errors or omissions in the contents
> of this message which arise as a result of e-mail transmission.  If
> verification is required please request a hard-copy version.  This
> message is provided for informational purposes and should not be
> construed as a solicitation or offer to buy or sell any securities or
> related financial instruments.
>
>
>
> ---------------------------------------------------------------------
> 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