Nick,

If you want to call a target within the same project. Use Ant-contrib's runtarget task (http://ant-contrib.sourceforge.net/tasks/tasks/index.html). Since the call is in the same project, any property you set in the called target is also visible to caller

If you want AntCall like behavior, then consider using AntCallBack task in http://ant-contrib.sourceforge.net/tasks/tasks/index.html

--Vishal


[EMAIL PROTECTED] wrote:

So, you saying I am being silly? ;-)

I was expecting different behaviour - but what you say makes perfect
sense...

Thanks for sorting that out...

-Nick




-----Original Message-----
From: Andrew Goktepe [mailto:[EMAIL PROTECTED] Sent: 25 July 2006 00:13
To: Ant Users List
Subject: Re: Am I being a silly - or is there an antcall bug?

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, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] For additional

commands, e-mail: [EMAIL PROTECTED]



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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Reply via email to