ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brown, Carlton" <Carlton.Br...@BellSouth.com>
Subject Conditional dependencies
Date Mon, 19 Mar 2007 22:20:57 GMT
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



Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message