ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Platform-specific properties
Date Thu, 04 Apr 2002 06:13:15 GMT
On Wed, 3 Apr 2002, John Lindwall <JLindwall@Xifin.com> wrote:

> What is your reaction to handling platform-specific properties as
> shown below?  Is there a better way?

I'd load property files instead of using targets. 

If all you need is to distinguish between Windows and non-Windows,
this could be as simple as

  <condition property="property-file" value="windows.properties">
    <and>
      <os family="windows" />
    </and>
  </condition>
  <property name="property-file" value="non-windows.properties" />
  <property file="${property-file}" />

This takes advantage of immutable properties, if <condition> has set
the property property-file, the property task after that won't do
anything.

You can extend this to more than two files by using more <condition>s
easily, this scales better than one target per environment IMHO.

Stefan

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message