ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Les Hughes <leslie.hug...@rubus.com>
Subject RE: Cross-platform properties?
Date Thu, 10 May 2001 09:17:39 GMT

Or do what I do. I have a per environment props file (build.properties) that
my SCM maps out into $basedir/conf/build.properties on all systems
(different files per system).

I then just have to do a <property file="${basedir}/conf/build.properties"/>
and the correct props for the platform are automagically made available.

Les.

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org]
> Sent: 10 May 2001 07:26
> To: ant-user@jakarta.apache.org
> Subject: Re: Cross-platform properties?
> 
> 
> Mark Jaffe <mjaffe@eturn.com> wrote:
> 
> > I am working with a project that needs to work on both unix and
> > NT. IUs there an easy way to set properties that will know their
> > platform?
> 
> Yes, use property tasks inside of targets that will only be executed
> on the appropriate OS.  Using a very Unix simple heuristic (everything
> that doesn't have a C:\config.sys is Unix, everything that does is
> Windows) this would look like
> 
> <target name="os-check">
>   <available property="win" file="C:\config.sys" />
> </target>
> 
> <target name="set-for-windows" depends="os-check" if="win">
>   <property name="home" value="c:\winnt\profiles\user" />
> </target>
> 
> <target name="set-for-unix" depends="os-check" unless="win">
>   <property name="home" value="/home/user" />
> </target>
> 
> <target name="set" depends="set-for-windows,set-for-unix" />
> 
> Stefan
> 
> PS: You are not trying to reinvent ${user.home}, are you?
> 

Mime
View raw message