Hi Troy,
I've clarified the <call> task docs a bit (in cvs). I
hope this will clear things up for you.
-----------
To avoid dependent targets from being executed more
than once, two options are available:
- Add an "unless" attribute with value "${target::has-executed('
<target name>
')}" to the dependent targets. - Set the
"cascade" attribute on the <call> task to false (
recommended
).
cascase = Execute the specified targets dependencies -- even if they have been
previously executed. The default is true.
---------
I've also updated the example:
This shows how a project
could 'compile' a debug and release build using a common compile target.
<project default="build"> <property name="debug" value="false" /> <target name="init"> <echo message="initializing" /> </target> <target name="compile" depends="init"> <echo message="compiling with debug = ${debug}" /> </target> <target name="build"> <property name="debug" value="false" /> <call target="compile" /> <property name="debug" value="true" /> <call target="compile" /> </target> </project>
The cascade
parameter of the <call>
task defaults to true, causing the "init" target to be executed for both
the "debug" and "release" build.
This results in the following build log:
build: init: [echo] initializing compile: [echo] compiling with debug = false init: [echo] initializing compile: [echo] compiling with debug = true BUILD SUCCEEDED
If the "init" should only be executed once, set the cascade
attribute of the <call>
task to false.
The build log would then look like this:
build: init: [echo] initializing compile: [echo] compiling with debug = false compile: [echo] compiling with debug = true BUILD SUCCEEDED
Hope this helps,
Gert
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Troy Laurin
Sent: vrijdag 13 mei 2005 7:26
To: Ian MacLean
Cc: Gary Feldman; NAnt Users
Subject: Re: [Nant-users] mixing call and depends
On 5/13/05, Ian MacLean <[EMAIL PROTECTED]> wrote:
Gary Feldman wrote:
> Check out the cascade attribute of the <call> task,
> http://nant.sourceforge.net/nightly/latest/help/tasks/call.html .
>
Thats exactly right - maybe another doc fix is required. cascade="true"
means execute dependencies and is the default.
From the original email it sounds like the called task's dependencies are being executed even though they have already been called. My understanding of the cascade attribute from the documentation is that is governs whether the dependencies will be evaluated _at all_... that is, if cascade="false", then execute only the called target; if cascade="true", then evaluate the called target's dependencies as normal... ie, execute the called target's dependencies if they haven't already been executed.
Or is cascade more like an "extended force", whereby the called task and its entire dependency tree will always be executed?
--
Troy