ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wayne Cannon <>
Subject Re: Conditional dependencies
Date Tue, 20 Mar 2007 15:06:17 GMT
Hmmm.  [Ant newbie thinking]  Just as there is a "fail" task, could 
there not be a "succeed" task added that would cause the enclosing task 
to simply return as though it were successful.  This would be a general 
purpose tool that could be invoked conditionally for any number of 
reasons.  It would provide a clean solution for Carlton and a nice, 
flexible, tool for other purposes as well.  --Wayne

Brown, Carlton wrote:
> There's a build behavior pattern I keep hitting, but I don't know how to
> resolve in Ant.   How can I specify a dependency chain among targets
> such that the dependency chain can be "short-circulted" with a property
> that prevents all the others from being resolved?
> For example, lets say I have this linear dependency chain:
> dist -> jar -> compile -> clean
> Obviously the target declarations will be:
> <target name="dist" depends="jar">
> <target name="jar" depends="compile">
> etc.
> In most cases, I want to run the whole graph.   But sometimes I just
> want to run dist and jar, short-circuiting the dependency graph before
> "compile", preventing it or any of its dependencies from executing.  I'm
> not even interested in letting ant cycle through the tasks and determine
> that they don't need to be done.
> Of course my first thought was to try a condition on the target:
> <target name="compile" unless="no.compile">
> Which doesn't do what I need.. it skips the "compile" step, but it won't
> skip compile's dependencies ("clean" still runs).   
> Next I pondered creating these discrete tasks as independent tasks, and
> then composing my dependency chain of wrapper tasks:
> <target name="dist" depends="jar">
> 	<antcall target="dist-impl"/>
> </target>
> <target name="dist-impl">
> 	<!-- no dependencies, just the facts ma'am -->
> 	<tar>
> 		<tarfileset blah blah blah/>
> 	</tar>
> </target>
> Is that the only choice?  My actual dependency chain is as deep as 6 or
> 7 levels in some places.  Creating a parallel sham dependency chain is
> teh suck.  Isn't there a better way?
> Thanks,
> Carlton
> *****
> The information transmitted is intended only for the person or entity to which it is
addressed and may contain confidential, proprietary, and/or privileged material. Any review,
retransmission, dissemination or other use of, or taking of any action in reliance upon this
information by persons or entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the material from all computers.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message