ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erskine, Chris" <chris.ersk...@eds.com>
Subject RE: Cross-Platform Exec Task
Date Fri, 29 Oct 2004 11:41:13 GMT
If you are looking at just choosing between a shell script under *nix and a
batch or command file under Windows, a quick trick is to execute
'executable'. On Windows, it will execute 'executable.[bat|cmd|exe] while
under *nix, it will execute 'executable'.  This way, you do not have to do
any conditionals or due special logic in the build script.

Chris Erskine
 
EDS Consulting Services
F5-EDS-001
2424 Garden of the Gods Rd
Colorado Springs, CO  80919
 
Phone: 719-535-6064

> -----Original Message-----
> From: Satish Jeejula [mailto:Satish_Jeejula@irco.com]
> Sent: Thursday, October 28, 2004 5:45 PM
> To: user@ant.apache.org
> Subject: Cross-Platform Exec Task
> 
> Hi All,
> 
> I am trying to write a target that calls an different executable
> depending upon the operating system it is running on. For example, this
> is my intention.
> 
> <target name="runExecutable">
> 
>             <!-on windows 2000 or XP -->
>         <exec executable="executable.bat" />
> 
>             <!-on UNIX Solaris or AIX -->
>         <exec executable="executable.sh" />
> 
> </target>
> 
> I can't include element "os" in the "exec" .
> 
> if I have to use 'os' attribute in the 'exec', I have provide correct
> value to it and redundant code is the result. This is what I am doing
> right now.
> 
> <target name="runExecutable">
> 
>             <!-on windows 2000 -->
>         <exec executable="executable.bat" os="Windows XP" />
> 
>             <!-on windows XP -->
>         <exec executable="executable.bat"  os="Windows 2000"/>
> 
> 
>             <!-on UNIX Solaris -->
>         <exec executable="executable.sh" os="SunOS"/>
> 
>             <!-on UNIX AIX -->
>         <exec executable="executable.sh" os="Aix"/>
> 
> 
> </target>
> 
> 
>  Is there any way to generalize it?
> 
> Thanks,
> Satish
> 
> 
> 
> 
> -----------------------------------------
> The information contained in this message is privileged and intended only
> for the recipients named. If the reader is not a representative of the
> intended recipient, any review, dissemination or copying of this message
> or
> the information it contains is prohibited. If you have received this
> message in error, please immediately notify the sender, and delete the
> original message and attachments.

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


Mime
View raw message