ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nolan Ring <Nolan.R...@sun.com>
Subject trycatch and recursive make
Date Fri, 24 Jan 2003 20:27:45 GMT



Hi,

As a part of our build process we are exec'ing a call to make ... which, 
in turn, calls make, which in turn calls make ... etc, etc, etc.

If the initial call to make from the build.xml fails trycatch catches 
the error and echos the correct message.  If, however, make fails 
several levels down, trycatch doesn't  return the "catch" message. 
Is there anyway to capture these errors from exec?

Here's the build.xml snippet:

 <target name="csrc" depends="init">
   <trycatch>
   <try>
      <exec executable="make" dir="${csrcDir}" resultproperty="result" >
          <arg line="-f Makefile.sun CSRC_ROOT=${csrcDir} 
AGENT_ROOT=${basedir}"/>
      </exec>
   </try>
   <catch>
      <echo>CAUGHT MAKE FAILURE</echo>
   </catch>

 </trycatch>
 </target>

The output if the exec of make fails immediately is the following:

csrc:
    [exec] make: Makefile: No such file or directory
    [exec] make: *** No rule to make target `Makefile'.  Stop.
[trycatch] Caught exception: exec returned: 2
    [echo] CAUGHT MAKE FAILURE
    [echo] Resultproperty is: 0

If a failure occurs deeper down in the make structure all I get is the 
following:
csrc:
    [exec] make[1]: Entering directory 
`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/uagent/src'
    [exec] make[1]: Makefile: No such file or directory
    [exec] make[1]: *** No rule to make target `Makefile'.  Stop.
    [exec] make[1]: Leaving directory 
`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/uagent/src'
    [exec] make[1]: Entering directory 
`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/arp/server'
    [exec] make[1]: Makefile: No such file or directory
    [exec] make[1]: Leaving directory 
`/var/AccuRev_ws/marwks33_oriole_Plat_Int/agent/csrc/arp/server'
    [exec] make[1]: *** No rule to make target `Makefile'.  Stop.
    [echo] Resultproperty is: 0

Thanks for any help.

Nolan







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


Mime
View raw message