ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: <succeed/> ?
Date Fri, 03 Oct 2003 14:46:20 GMT
> -----Original Message-----
> From: Spencer Phil (KTXA 2) [mailto:phil.spencer@credit-suisse.com]

> My build is a huge, dynamically discovered, recusive tree
> walk. At certain points in the tree I may discover conditions
> that mean I can't progress further. These conditions may be
> true error conditions (<fail/>) or conditions that mean I should
> just stop or display an advisory message and stop <succeed/>.

May I suggest a solution that should work now? Not ideal, but still useful.

Assuming you enter one of your sub-build from a single target
(say "build"), and can write a target that determines whether
you should "succeed" early or not, setting an appropriate property.
By making the "build" target execution conditional on this property,
you can bypass the rest of the build, and thus implicitly "succeed".

If you enter the build using more target, or want to "succeed" deeper
in the dependent target graph, it's still applicable but more cumbersome.

The <succeed/> task you suggest is equivalent to a return statement,
Which will never make it to Ant. <fail/> is warranted IMHO, whereas
<succeed/> is not.

Another approach is to use try/catch at the point you <ant>
your sub-build (where you return early using <fail>), but then
you cannot easily distinguish real failures from early return ones...

--DD

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


Mime
View raw message