You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Brown, Carlton" <Ca...@BellSouth.com> on 2007/03/19 23:20:57 UTC

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



Re: Conditional dependencies

Posted by Wayne Cannon <wc...@turinnetworks.com>.
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@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Conditional dependencies

Posted by Yves Martin <yv...@elca.ch>.
On Mon, 2007-03-19 at 22:20 -0400, Brown, Carlton wrote:
> 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.  

I know it is ugly but in development this kind of mechanism is called
"exception".
So I propose you to replace unless="no.compile" in target "compile" by a
if (contrib) clause to test 'no.compile' and throw an exception.
The problem in such a design: Ant build aborts and it is not possible to
catch the exception (try/catch from contrib) unless to replace "depends"
declaration by an explicit antcall inside a try statement.

Another option I imagine: a specific task inserts a listener in the
running Ant project, and this listener may (I'm not sure) prevent a
target to be executed according to "no.TARGET" properties for instance. 

For the moment, it really sounds like a ugly hack as far as a listener
is not designed to prevent a target execution but it is a way.

Regards
-- 
Yves Martin

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


RE: Conditional dependencies

Posted by Gilles Scokart <gs...@gmail.com>.
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


RE: Conditional dependencies

Posted by "Brown, Carlton" <Ca...@BellSouth.com>.
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


RE: Conditional dependencies

Posted by "Murray, Mike" <mb...@ptc.com>.
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


RE: Conditional dependencies

Posted by "Brown, Carlton" <Ca...@BellSouth.com>.
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


RE: Conditional dependencies

Posted by bill/wilandra <bi...@wilandra.com>.
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


RE: Conditional dependencies

Posted by "Murray, Mike" <mb...@ptc.com>.
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