You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Timothy Wall <tw...@oculustech.com> on 2003/02/18 16:03:31 UTC

Conditional target execution based on prerequisite execution

How does one configure an ant build script such that target B is
executed if and only if target A has been run?  I realize that this
*can* be accomplished by having target A set a property and B only run
if that property is set, but given that this is such a fundamental
notion in building large, complex projects, I'm surprised that there is
not a more fundamental level of support for it in ant, particularly
given its claims as a "make without the wrinkles". I'm finding ant to
be more of "less flexible make using java, without some of the
features".

I didn't find any reference to such dependency tracking, but perhaps my
terminology is incorrect.

I would expect something like
<target name="A"/>
<target name="B" depends="A" onlyif="A-was-run"/>

Where the idea is that some property "A-was-run" gets set automagically
whenever A is actually run.

If this feature is already in there somewhere, please point me to it.
I'm assuming it's not, since the "depends" documentation explicitly
states that it has absolutely no effect on whether or not a target gets
run, and provides no links to any facility which might have such an
effect.