I think what you want is this:

            <target name="BuildDebug">

            <property name="debug" value="true" />

                        <nant buildfile="myapp" inheritall="true" verbose="true" />

            </target>

            <target name="BuildRelease" depends="FrameworkTestExecute">

                        <property name="debuge" value="false" />                       -->

                        <nant buildfile="myapp" inheritall="true" verbose="true" />

            </target>

 

cause build files evaluate "global tasks" (any non-target task at the project level) before calling any target.

 

So the execution order goes something like this:

 

<project default="first">

    <property name="debug" value="true"/>

    <target name="first"/>

    <property name="debug" value="false"/>

    <target name="second"/>

    <property name="debug" value="haha"/>

    <property name="debug" value="hehee"/>

</project>

 

Note: 1-4 are "global tasks"

1.) prop debug true

2.) prop debug false

3.) prop debug haha

4.) prop debug hehee

5.) target first

----- Original Message -----
From: Dave Lloyd
Sent: Thursday, February 13, 2003 11:15 PM
Subject: RE: [Nant-users] Properties

Kevin…

 

Thanks for the response. You said “You can update it later on in your script, no problem  If this is correct I’m doing something wrong.

 

I set a property to one value then later in the script I changed it to something else. But the only value it ever seems to have is the second value I assign to it.

 

Here is an example:

 

 

I am calling builds from within other builds. I have a build file that compiles myapp. I’m using inheritall so the sub nant calls pick up the properties of the parent. I want to be able to call myapp.build with the debug property set to True. Then later from the same script call it again this time with debug set to false.

 

But when I do this it’s always false.

 

If there is a way to do this with the current version I’m using 0.7.9

 

Dave Lloyd

 

-----Original Message-----
From: Miller, Kevin [mailto:[EMAIL PROTECTED]]
Sent:
Thursday, February 13, 2003 6:36 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [Nant-users] Properties

 

Once you set a property I believe it is scoped to the entire project meaning it is visible everywhere. You can update it later on in your script, no problem.

 

Note, If you set a property via the commandline inputs those properties are ReadOnly and cannot be changed. You can try to update ReadOnly properties but they will not change.

 

The core questions I think you are asking is will properties set by the nant task update the parent/calling task. I do not think so but it would be easy to test.

 

I think a property scoping topic would be a nice NAnt Wiki entry.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent:
Thursday, February 13, 2003 5:04 PM
To: [EMAIL PROTECTED]
Subject: [Nant-users] Properties

Can I reuse a property? I want to set a property then change it later in the script.

 

I want to have one build file that can switch depending on a variable. Is this not what properties are for?

 

When I set the property it is always what ever I set it to last. Can anyone tell me how I would do this?

 

<property name="build.dir" value="bin\Debug" />

            <property name="debug" value="True" />

            <target name="Debug">

                        <nant buildfile="foo.build" inheritall="true" verbose="True" />

            </target>

           

<property name="build.dir" value="bin\Release" />

            <property name="debug" value="False" />

            <target name="Release">

                        <nant buildfile="foo.build" inheritall="true" verbose="True" />

            </target>

 

Dave Lloyd

Reply via email to