ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles Scokart" <gscok...@gmail.com>
Subject RE: Conditional dependencies
Date Tue, 20 Mar 2007 08:03:11 GMT
I tried once a similar approach, but it was also rather heavy.

I conditioned every task with a .skip, and before every target, I placed
conditions that were setting the dependencies .skip variable.   Of curse,
you have to place them in the correct order.

I also tried to have 'stop_at' variables used to conditionally set some
.skip properties.  But it was heavy to maintain, so I did it only for some
target where it is usual to skip dependencies.

Finally, the approach I'm using now is to define some sort of .only target
for the one that I want to run alone (mainly when testing the script).


Gilles


> -----Original Message-----
> From: Brown, Carlton [mailto:Carlton.Brown@BellSouth.com]
> Sent: mardi 20 mars 2007 3:21
> To: Ant Users List
> Subject: RE: Conditional dependencies
> 
> 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.
> 
> -----Original Message-----
> From: Murray, Mike [mailto:mbm@ptc.com]
> Sent: Monday, March 19, 2007 10:08 PM
> To: Ant Users List
> Subject: RE: Conditional dependencies
> 
> I use a combination of .only targets and .skip properties to
> "essentially" accomplish this.
> 
> ant dist.only jar.only
> 
> OR
> 
> ant dist -Dcompile.skip=1 -Dclean.skip=1
> 
> -----Original Message-----
> From: Brown, Carlton [mailto:Carlton.Brown@BellSouth.com]
> Sent: Monday, March 19, 2007 8:24 PM
> To: Ant Users List
> Subject: RE: Conditional dependencies
> 
> I guess I didn't specifically say this, but I need the targets, if they
> run, to run in order of dependency.  There is no guarantee that an
> arbitrary list of targets will run in a certain order.
> 
> It would be really nice if there were an option to specify a target may
> not be in the dependency graph, likesay given the graph I described
> below, dist -> jar -> compile -> clean
> 
> ant dist -Dstopbefore=compile
> 
> would cause the build to run the dependency graph in the specified order
> but stop before executing "compile".
> 
> 
> -----Original Message-----
> From: bill/wilandra [mailto:bill@wilandra.com]
> Sent: Monday, March 19, 2007 8:47 PM
> To: 'Ant Users List'
> Subject: RE: Conditional dependencies
> 
> 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
> 
> 
> *****
> 
> 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. GA621
> 
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> *****
> 
> 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. GA622
> 
> 
> 
> ---------------------------------------------------------------------
> 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