Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Conditional dependencies

Conditional dependencies

2007-03-20       - By Yves Martin
Reply:     1     2     3     4     5     6     7     8     9  

On Mon, 2007-03-19 at 22:20 -0400, Brown, Carlton wrote:
> I don't mind doing that for one-offs.   But for a dependency graph of 7
> or more targets... no thanks!   But I guess there's not much choice
> since I can't think of any other good way to do it.  

I know it is ugly but in development this kind of mechanism is called
"exception".
So I propose you to replace unless="no.compile" in target "compile" by a
if (contrib) clause to test 'no.compile' and throw an exception.
The problem in such a design: Ant build aborts and it is not possible to
catch the exception (try/catch from contrib) unless to replace "depends"
declaration by an explicit antcall inside a try statement.

Another option I imagine: a specific task inserts a listener in the
running Ant project, and this listener may (I'm not sure) prevent a
target to be executed according to "no.TARGET" properties for instance.

For the moment, it really sounds like a ugly hack as far as a listener
is not designed to prevent a target execution but it is a way.

Regards
--
Yves Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.