You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Bhatia Saurabh (CHA)" <sa...@etat.ge.ch> on 2005/11/24 10:49:44 UTC

Recovering the return code from the called build.xml into the calling build.xml

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
 

Calling build.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" />  
         		<!--
         		<condition property="run-test.result"
value="${run-test.result}">
         		</condition>
         		-->
         		<echo message="Status of task run-test is
${run-test.result}" />         		
        	</sequential>
        </macrodef>


Called build.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" 
         newenvironment="true" 
         executable="TestUnitaire_auto.bat" 
         resolveexecutable="true" 
         output="dir.txt" 
         resultproperty="run-test.result" 
         failonerror="false" 
         vmlauncher="true">                  
   </exec>
   <echo message="runtest return code = ${run-test.result}" />
  </target>



Re: Recovering the return code from the called build.xml into the calling build.xml

Posted by Antoine Levy-Lambert <an...@gmx.de>.
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\)" <sa...@etat.ge.ch>
> An: <us...@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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org