I guess the simplest way would be to have a properties file per-platform,
and simply load it using:

<property file="${basedir}/build-${platform}.properties" />

You just have to come up with a way to define properties so that it suits
your needs. This can be achieved different ways, for example in an 'init'
target (hopefully <condition> respects immutability of properties in
1.4.1!):

<target name="init">
  <condition property="platform" value="win32">
    <os family="windows" />
  </condtion>
  <condition property="platform" value="unix">
    <os family="unix" />
  </condtion>

  <property file="${basedir}/build-${platform}.properties" />
</target>

It would be nice to be able to access an os.family property direclty instead
of having to do multiple <condition>s though...

Or if you prefer to have everything in build.xml, then you use targets:

<target name="set-properties"
        depends="set-platform, set-properties.win32, set-properties.unix">
  <!-- properties common to all platforms -->
  <property name="common-prop" value="blah blah" />
</target>

<target name="set-platform">
  <condition property="platform.win32">
    <os family="windows" />
  </condtion>
  <condition property="platform.unix">
    <os family="unix" />
  </condtion>
</target>

<target name="set-properties.win32"
        if="platform.win32">
  <property name="some-prop" value="win32 blee blee" />
</target>

<target name="set-properties.unix"
        if="platform.unix">
  <property name="some-prop" value="unix blee blee" />
</target>

If use can use Ant 1.5 beta with ant-contrib's <if> task, then it should be
pretty straightforward to do what you want. Don't have either, so you're on
your own ;-) --DD

-----Original Message-----
From: Gary Grobe [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, May 21, 2002 1:59 PM
To: [EMAIL PROTECTED]
Subject: dynamic properties

I'm looking for a way to say, if this platform then set these 
properties, else if this platform, then set the same properties for the 
same target, but with different values. Found a few ways  but am hoping 
for something better.

Thnxs.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to