This is great. Thank you so much for the thorough explanation and examples.
:)
----Original Message Follows----
From: Ninju Bohra <[EMAIL PROTECTED]>
Reply-To: Ninju Bohra <[EMAIL PROTECTED]>
To: Ant Users List <user@ant.apache.org>
Subject: Re: Antcall task not doing what I want it to do!
Date: Thu, 16 Mar 2006 19:46:54 -0800 (PST)
MIME-Version: 1.0
Received: from mail.apache.org ([209.237.227.199]) by
bay0-mc10-f16.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Thu,
16 Mar 2006 19:47:18 -0800
Received: (qmail 3422 invoked by uid 500); 17 Mar 2006 03:47:16 -0000
Received: (qmail 3411 invoked by uid 99); 17 Mar 2006 03:47:16 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by
apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Mar 2006 19:47:16 -0800
Received: pass (asf.osuosl.org: local policy)
Received: from [68.142.200.92] (HELO web30209.mail.mud.yahoo.com)
(68.142.200.92) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 16 Mar 2006
19:47:15 -0800
Received: (qmail 11956 invoked by uid 60001); 17 Mar 2006 03:46:54 -0000
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
List-Help: <mailto:[EMAIL PROTECTED]>
List-Post: <mailto:user@ant.apache.org>
List-Id: "Ant Users List" <user.ant.apache.org>
Delivered-To: mailing list user@ant.apache.org
X-ASF-Spam-Status: No, hits=2.6
required=10.0tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_WHOIS,FORGED_YAHOO_RCVD,HTML_MESSAGE,MAILTO_TO_SPAM_ADDR
X-Spam-Check-By: apache.org
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com;
h=Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type;
b=NgINqKgBBSAZdNV+XOnVIsIyLEH7PUto3YBpGGvNzD9t++Sx8l0eL3WzMGFU1XFXOaoOxrFKbTtKZvNZx+rVjOOqjSYojQTxcUWMTlDmhoh+LHYakFutwH+LUwWOJEBYshwii3hf6eDizinazS4GB8WqhhTsq6i4dLXZLEGhUWI=
;
X-Virus-Checked: Checked by ClamAV on apache.org
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 17 Mar 2006 03:47:18.0741 (UTC)
FILETIME=[7D373850:01C64975]
Hello Res Pons,
By design the <antcall> task loads an new "ANT" session in which the
"target" task is run in and when the "target" task is completed the "ANT"
session is destroyed and no property values/path refs are carried back into
the calling session (think of the <antcall> task as a subroutine call where
all the state (i.e. property creation/assingments) is kept in local
variables, when the rountine finishes all the local variables are gone).
Prior to some earlier verison (ANT 1.6 I believe) the only way to "chain"
targets together and allow property values to remain was through the
depends="<list of targets>" attribute because each of the dependent targets
would run in same "ANT" session.
After the ANT 1.6, the <macrodef> task was created which allowed you to
define a resuable set of ANT tasks that ran under the same "ANT" session.
If within a <macrodef> task you set a property (or path set) it would be
visible (and final) for the life of the 'ANT' session.
You can re-write you example, using <macrodef>s as follows:
<macrodef name="newbuildnum" >
<sequential>
<buildnumber file="build/build.number"/>
<property name="full.build.number" value="${build.number}" />
<echo message="And the full build.number in destination target is ==>
${full.build.number}" />
</sequential>
</macrodef>
<target="callbuildnumber" >
<!-- we now invoke the macrodef we created. Note we reference the macrodef
as an element
just a "custom" task --->
</newbuildnum>
<echo message="And the full build.number in calling target is ==>
${full.build.number}" />
</target>
Please read up on the <macrodef> task in the ANT help for further
information on this powerful new addition.
Also for the ANT documentation group, I might be nice to add some verbage
to the <antcall> task documentation pointing that fact that properties
values are transported across the <antcall>.
After all that has been said, if you REALLY REALLY need to bring back some
property values from a <antcall> invocation you can look into the
<antcallback> task from the ant-contrib project, however I would use that
only as a last resort.
----- Original Message ----
From: Res Pons <[EMAIL PROTECTED]>
To: user@ant.apache.org
Sent: Thursday, March 16, 2006 6:52:54 PM
Subject: Antcall task not doing what I want it to do!
Hi everyone!
I'm making an antcall from the source target to its destination target.
<targe="callbuildnumber" >
<antcall target="newbuildnum" />
<echo message="And the full build.number in calling target is ==>
${full.build.number}" />
</targe>
<targe="newbuildnum" >
<buildnumber file="build/build.number"/>
<property name="full.build.number" value="${build.number}" />
<echo message="And the full build.number in destination target is ==>
${full.build.number}" />
</targe>
Naturally the echo stmt in the newbuildnum target works but how do I get it
back to callbuildnumber target, the echo stmt in this target does not work?
_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]