Maybe, I don't understand the problem right, but why don't you assign the
return code to another property ??

E.g.  
<macrodef name="test-exec">
        <attribute name="module-1"/>            
        <attribute name="return"/>              
<sequential>
        <echo message="Test du module @{module-1} (lancement target
run-test)" />                   
        <ant dir="${revue.dir}/@{module-1}" target="run-test"/>
        <antcallback return="run-test.result"/>  
        <echo message="Status of task run-test is ${run-test.result}" />    
        <var name="@{return}" value="${run-test.result}" />    
</sequential>
</macrodef>

> -----Original Message-----
> From: Bhatia Saurabh (CHA) [mailto:[EMAIL PROTECTED] 
> Sent: 25 November, 2005 11:42
> To: Ant Users List
> Cc: [EMAIL PROTECTED]; Bhatia Saurabh (CHA)
> Subject: RE: Recovering the return code from the called 
> build.xml into the calling build.xml
> 
> Hello Antoine,
> After all my tests on this taskdef, I found that an 
> antcallback works in the scope of 1 single build.xml file 
> ONLY. If my 1st build.xml file makes a call to a target in 
> another build.xml which in turn does an exec on the host 
> system, I have no way of recovering the 
> resultproperty="my.property" in the first build.xml.
> 
> Example:
> Caller code -------------------------------- build1.xml
>       
>         <macrodef name="test-exec">
>                       <attribute name="module-1"/>            
>                       <sequential>
>                       <echo message="Test du module 
> @{module-1} (lancement target run-test)" />                   
>                       
>                       <ant dir="${revue.dir}/@{module-1}" 
> target="run-test"/>
>                       <!--
>                       <antcallback return="run-test.result"/>  
>                       -->
>                       <echo message="Status of task run-test 
> is ${run-test.result}" />                     
>               </sequential>
>         </macrodef>
> Called code................................. build2.xml
> 
> <target name="run-test" description="lancement du test unitaire">
>    <echo message="lancement du test unitaire EvenementMetier!!" />
>    <exec dir="J:/RefonteAFC/Proto1.4/EvenementMetier/testunitaire" 
>          executable="TestUnitaire_auto.bat" 
> resolveexecutable="true" output="dir.txt" 
> resultproperty="run-test.result"                 
> failonerror="false" vmlauncher="true">
>    </exec>
>   </target>
> 
> Thanks a lot for the pointers anyway... I hope I do find a 
> solution to this really....Its like saying that a Java object 
> can recover the return value only if the called method is 
> defined in the same object.
> 
> Saurabh
> 
> 
> 
> -----Message d'origine-----
> De : Antoine Levy-Lambert [mailto:[EMAIL PROTECTED] Envoyé : 
> jeudi, 24. novembre 2005 22:09 À : Ant Users List Objet : Re: 
> Recovering the return code from the called build.xml into the 
> calling build.xml
> 
> Hello Saurabh,
> look at using ant-contrib.
> http://ant-contrib.sourceforge.net/tasks/tasks/antcallback_task.html
> Cheers,
> Antoine
> > --- Ursprüngliche Nachricht ---
> > Von: "Bhatia Saurabh \(CHA\)" <[EMAIL PROTECTED]>
> > An: <user@ant.apache.org>
> > Betreff: Recovering the return code from the called 
> build.xml into the 
> > calling build.xml
> > Datum: Thu, 24 Nov 2005 10:49:44 +0100
> > 
> > Dear Community,
> > 
> > My calling build.xml makes a call to a target defined in a 
> different 
> > build.xml and this target does an exec. I do get the return 
> value from 
> > this exec in the called build.xml but I am looking for a 
> solution for 
> > recovering this resultproperty="run-test.result" in the 
> calling code 
> > so that I can invoke other targets in my calling build.xml based on 
> > the return code I got from the called build.xml. (e.g I 
> would like to 
> > send an email with success notification if the return code = 0 or a 
> > failure email notification if the return code is anything but 0).
> > 
> > Really appreciate your solutions and thanking in advance.
> > 
> > Saurabh
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED] For 
> additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED] For 
> additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to