ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shankar Unni <shan...@intruvert.com>
Subject RE: Setting a property based on the OS
Date Mon, 20 Aug 2001 21:08:33 GMT
Here's a fragment from one of my files:

  <!-- set a property whose name is based on what OS we are -->
  <property name="${os.name}.install" value="dummy"/>

  ...

  <!-- a set of install targets, that does host-dependent things -->
  <target name="install"
          depends="installprep,installwin,installlinux,installsol"/>

  <target name="installprep">
     <uptodate property="action.notrequired" ...>
        ...
     </uptodate>
     ...
  </target>
  <target name="installwin" 
          if="Windows 2000.install" 
          unless="action.notrequired">
     <!-- action steps -->
  </target>
  <target name="installlinux" 
          if="Linux.install" 
          unless="action.notrequired">
     <!-- action steps -->
  </target>
  <target name="installsol" 
          if="SunOS.install" 
          unless="action.notrequired">
     <!-- action steps -->
  </target>

  ...

> -----Original Message-----
> From: T Master [mailto:tmaster@iknowledgeinc.com]
> Sent: Monday, August 20, 2001 2:12 PM
> To: ant-user@jakarta.apache.org
> Subject: Re: Setting a property based on the OS
> 
> 
> How would this then be used in a target?
> 
> ----- Original Message ----- 
> From: "Stefan Bodewig" <bodewig@apache.org>
> To: <ant-user@jakarta.apache.org>
> Sent: Monday, August 20, 2001 1:04 PM
> Subject: Re: Setting a property based on the OS
> 
> 
> > On Mon, 20 Aug 2001, Kurien Mathew <kurien@envivio.com> wrote:
> > 
> > > Is it possible to set a property based on the OS?
> > 
> > > redist
> > >  |- win32
> > >  |- mac
> > >  |- linux
> > > 
> > 
> > Using 1.4beta
> > 
> > <condition property="redistdir" value="redist/win32">
> >   <os family="windows" />
> > </condition>
> > <condition property="redistdir" value="redist/mac">
> >   <os family="mac" />
> > </condition>
> > <condition property="redistdir" value="redist/linux">
> >   <equals arg1="${os.name}" arg2="Linux" />
> > </condition>
> > 
> > Stefan
> > 
> 

Mime
View raw message