ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan \"Rambius\" Ivanov" <rambiusparkisan...@yahoo.com>
Subject Re: Detecting what OS you are running...
Date Thu, 23 Feb 2006 23:51:14 GMT
Hello,

here are some hints.
1) You can use os.name property to find the OS you are
running on.
2) If you want to execute a native OS command only on
the OS that supports it you can use <exec> task with
os attribute. See [1] for more details.
3) If you want to run different targets depending on
the os you can use <condition> with nested <os>
element [2]:

<condition property="isWindows">
  <os family="windows"/>
</condition>

<condition property="isUnix">
  <os family="unix"/>
</condition>

<target name="execute"
  depends="executeUnix,executeWindows"/>

<target name="executeUnix" if="isUnix">
  <!-- Do Unix stuff -->
</target>

<target name="executeWindows" if="isWindows">
  <!-- Do Windows stuff -->
</target>

Regards
Ivan

[1]http://ant.apache.org/manual/CoreTasks/exec.html
[2]http://ant.apache.org/manual/CoreTasks/conditions.html

--- JG <z28quetzal@gmail.com> wrote:

> Hi,
> 
> I am writing an ANT config script that is to be used
> on multiple platforms 
> (Windows XP, Mac, Fedora) and I have a target that I
> want to run a certain 
> way for Windows XP and another way for other OS's.
> 
> Is there a way to make a target run only for a given
> OS?
> 
> thanks,
> joe
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Mime
View raw message