Ah, I see. The key point is that invoking a series of targets from the command line:
$ ant clean-all build-all
doesn't work the same as:
<target name="clean-and-build-all" depends="clean-all, build-all">
Yes.
That's fine. I wasn't suggesting that Ant be changed. It's just confusing and perhaps should be clarified in the manual.
I have also noticed that targets invoked using the <antcall> and <ant>
<antcall> is just a shortcut for <ant this>, if you know what I mean. In particular antcall results in a separate Ant execution context. This has a few implications:
Properties created in the <antcall> are not visible once the call is finished.
All the target deps are evaluated in the new context.
tasks have this "command-line target behavior" as well. This can be even more confusing to an Ant script writer, since (particularly with <antcall>) the subordinate task seems like it is being called in the context of other executing targets.
This "command-line target behavior" is easily explained by pointing out its equivalence to typing:
$ ant clean-all $ ant build-all
Well it's not actually the same :-). When you run
ant clean-all build-all
these targets are evaluated independently but within the same context. Properties set in clean-all would be visible to build-all. This would not be the case in separate executions. I realize this might be a little confusing :-)
The usefulness of this approach is to allow property setting targets which can affect the operation of later targets. For example,
ant with.debug compile
would enable the creation of properties and types which allow for a debug build.
This explanation easily extends to the <ant> task too.
The <antcall> task, however, seems like a much more likely candidate to ''play well with <target depends="">''. Has anyone ever suggested some mechanism to enable this? Perhaps a command-line option for Ant, or an attribute to <antcall> (and maybe <ant> as well)?
Personally, I use antcall when I want to execute a target in a separate context with different properties. If that's not the case you can usually achieve the required behaviour with simple depends="...", which most long time Ant developers would recommend strongly over <antcall>.
As things are, any use of <antcall> causes additional calls to dependent targets which usually don't need to be executed again.
Just to reiterate the above point in a slightly different way. If the targets don't need to be executed again, you can probably avoid the antcall altogether in favour of depends="..."
Conor
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]