Err... ummm.... this is even a little more complicated than how Task(s)
work.
Target attributes (if/unless/etc.) are evaluated when the target is
created, not called. This is one of the problems I've been alluding to
in reference to lazy-init'n until execution.
The model is that when the Element (Target and Task both derive from
Element) is created, Initialize() is then called. Initialize() then
inits the xml for the Element and sets from the xml attributes and
elements of that Element. In the case of target, 'if/unless' is set,
ExpandProperty() is called, and ${}s are evaluated. This is in fact how
validation occurs also.
This model works, but causes some unfortunate side effects. For one,
Targets, unlike Tasks, have their attribute values expanded and set far
before they are executed. In the case of Task(s) (in a Target) the xml
is evaluated right before the Task is created and executed. The time
between Init and Execute is one line of code :)
This is something that needs to be addressed and/or documented before a
1.0 release.
John, I really like your weblog :)
> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:nant-developers-
> [EMAIL PROTECTED]] On Behalf Of Shaw, Gerry
> Sent: Wednesday, June 26, 2002 8:00 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: [nant-dev] re: Effective NAnt
>
> John you are doing a great job documenting stuff about nant but what
you
> have a slight error on your Effective NAnt article.
> http://www.iunknown.com/Weblog/EffectiveNAnt.html
>
> NAnt evaluates properties at time of execution (very early versions
> didn't) so you should easily be able to have a target called with a
> different property. The problem is that by default nant will not
execute
> a target if it has already been called. You can override this with
the
> force attribute on the call task.
>
> ie,
>
> <project default="build">
> <target name="compile">
> <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" force="true"/> <!-- notice the
force
> attribute -->
> </target>
> </project>
>
> I will add this example to the CallTask documentation.
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: Jabber Inc.
> Don't miss the IM event of the season | Special offer for OSDN
members!
> JabberConf 2002, Aug. 20-22, Keystone, CO
http://www.jabberconf.com/osdn
> _______________________________________________
> Nant-developers mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-developers
-------------------------------------------------------
This sf.net email is sponsored by: Jabber Inc.
Don't miss the IM event of the season | Special offer for OSDN members!
JabberConf 2002, Aug. 20-22, Keystone, CO http://www.jabberconf.com/osdn
_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers