You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Res Pons <po...@hotmail.com> on 2006/03/17 01:52:54 UTC

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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Antcall task not doing what I want it to do!

Posted by Res Pons <po...@hotmail.com>.
This is great. Thank you so much for the thorough explanation and examples. 
:)

----Original Message Follows----
From: Ninju Bohra <ni...@yahoo.com>
Reply-To: Ninju Bohra <ni...@yahoo.com>
To: Ant Users List <us...@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 user-help@ant.apache.org; run by ezmlm
Precedence: bulk
List-Unsubscribe: <ma...@ant.apache.org>
List-Help: <ma...@ant.apache.org>
List-Post: <ma...@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: user-return-55233-pons32=hotmail.com@ant.apache.org
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 <po...@hotmail.com>
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

_________________________________________________________________
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Antcall task not doing what I want it to do!

Posted by Ninju Bohra <ni...@yahoo.com>.
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 <po...@hotmail.com>
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

Re: Antcall task not doing what I want it to do!

Posted by Res Pons <po...@hotmail.com>.
no, that's just my typo in this email.  The build file is spelled correctly. 
Thanks anyway :)

----Original Message Follows----
From: TH Lim <ss...@yahoo.com>
Reply-To: "Ant Users List" <us...@ant.apache.org>
To: Ant Users List <us...@ant.apache.org>
Subject: Re: Antcall task not doing what I want it to do!
Date: Thu, 16 Mar 2006 20:50:51 -0800 (PST)
MIME-Version: 1.0
Received: from mail.apache.org ([209.237.227.199]) by 
bay0-mc4-f1.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 16 
Mar 2006 20:51:15 -0800
Received: (qmail 39210 invoked by uid 500); 17 Mar 2006 04:51:14 -0000
Received: (qmail 39199 invoked by uid 99); 17 Mar 2006 04:51:14 -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 20:51:14 -0800
Received: pass (asf.osuosl.org: local policy)
Received: from [206.190.38.186] (HELO web51407.mail.yahoo.com) 
(206.190.38.186)    by apache.org (qpsmtpd/0.29) with SMTP; Thu, 16 Mar 2006 
20:51:12 -0800
Received: (qmail 54494 invoked by uid 60001); 17 Mar 2006 04:50:51 -0000
Received: from [4.78.20.194] by web51407.mail.yahoo.com via HTTP; Thu, 16 
Mar 2006 20:50:51 PST
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
Mailing-List: contact user-help@ant.apache.org; run by ezmlm
Precedence: bulk
List-Unsubscribe: <ma...@ant.apache.org>
List-Help: <ma...@ant.apache.org>
List-Post: <ma...@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=1.6 
required=10.0tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_WHOIS,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:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; 
  
b=XDtMHCL9SWKNiW9PIxQFlEJuVt+TNMBfUQ4F4k1JIIj6NboT9dczWFr6jnkfAVGTKZNZiWdsuY1lcOkfZqLtiLSLVb8DhxXAyKr+5vFQy2mqf1mq6A8sw874yl0JlwhuLhX1tKhI3ePQMOxxcXLBa8nhiM11Fm4pBEwfnj/4LR8= 
  ;
X-Virus-Checked: Checked by ClamAV on apache.org
Return-Path: user-return-55234-pons32=hotmail.com@ant.apache.org
X-OriginalArrivalTime: 17 Mar 2006 04:51:15.0770 (UTC) 
FILETIME=[6C4361A0:01C6497E]

Is it because it should be </target> instead of
</targe>?

--- Res Pons <po...@hotmail.com> wrote:

 > 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:
 > user-unsubscribe@ant.apache.org
 > For additional commands, e-mail:
 > user-help@ant.apache.org
 >
 >


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to 
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Antcall task not doing what I want it to do!

Posted by TH Lim <ss...@yahoo.com>.
Is it because it should be </target> instead of
</targe>?

--- Res Pons <po...@hotmail.com> wrote:

> 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:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org