Assuming you don't mean the builtin "basedir" property set as an attribute
to the
"project" tag, you could do this:
<target name="init_release" if="build.num">
<property name="base" value="${build.num}"/>
</target>
<target name="init_developer" unless="build.num">
<property name="base" value="."/>
</target>
<target name="init" depends="init_release, init_developer">
...
</target>
And make your other targets dependent (at least indirectly) on the "init"
target.
-Peter
-----Original Message-----
From: O'Hara, Patrick [mailto:patrick.ohara@workscape.com]
Sent: Monday, June 04, 2001 8:06 AM
To: Ant User Mailing List (E-mail)
Subject: A Question about conditional property setup
I am using Ant 1.3 on Win2K to do both developer and release builds. A
Release build will have build.num set to the build number. A Developer
build will have build.num set to nothing. I want to define a project.base
property with the following characteristics: If build.num is set the base
should be C:\ProjHome\ViewName\BuildNum. If build.num is set to nothing
then the project.base should be C:\ProjHome\ViewName.
I have looked at the if and unless attributes and I do not see a way to use
these to set the value. For now I am setting it with a environment
variable. Any help will be appreciated.
Patrick D O'Hara
N17 W24222 Riverwood Dr,
Suite 330
Waukesha, WI 53188-1162
(262)408-3849
(262)408-3840 Fax
|