ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bill/wilandra" <b...@wilandra.com>
Subject RE: Conditional dependencies
Date Tue, 20 Mar 2007 00:47:23 GMT
You could make all the targets independent and specify a blank delimited
list of targets on the command line.  
Bill
-----Original Message-----
From: Murray, Mike [mailto:mbm@ptc.com] 
Sent: Monday, March 19, 2007 2:34 PM
To: Ant Users List
Subject: RE: Conditional dependencies

I sympathize with your frustration.  I don't know of a better way.  It would
be nice if there was a -nodeps option.

Here's what I do, and I have many targets: 

<target name="dist" 	 depends="jar,dist.only">
<target name="jar" 	 depends="compile,jar.only">

<target name="dist.only" unless="dist.skip">
<target name="jar.only"	 unless="jar.skip">

-----Original Message-----
From: Brown, Carlton [mailto:Carlton.Brown@BellSouth.com]
Sent: Monday, March 19, 2007 5:21 PM
To: Ant Users List
Subject: Conditional dependencies

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@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org





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


Mime
View raw message