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 Wayne Cannon
Reply:     1     2     3     4     5     6     7     8     9  

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.
GA623
>
>
>
>  

---------------------------------------------------------------------
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.