You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Arun Gupta <ar...@sun.com> on 2002/04/26 01:23:17 UTC

Platform specific extensions

Hi,

I have .sh and .bat files for a multi-platform product. How can I tell 
build.xml to pick up correct extension file on a particular platform ?

Regards,
-Arun




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Platform specific extensions

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Yes.  Look at the <os> nested condition for <condition>.  You could set a
property to .sh if its Unix, and .bat for Windows using two <condition>
statements.

Or, you could make two <exec>'s with the right os="..." clause (although for
this you need the exact os.name string that your JVM provides).

    Erik


----- Original Message -----
From: "Arun Gupta" <ar...@sun.com>
To: "Ant Users List" <an...@jakarta.apache.org>
Sent: Thursday, April 25, 2002 8:14 PM
Subject: Re: Platform specific extensions


> For example I have a product with scripts foo.sh and foo.bat. Now I want
> to have an exec task in my build.xml such as:
>
> <exec executable="foo.${property}">
>     <arg line="some value">
> </exec>
>
> Can ${property} be set to ".sh" or ".bat" depending upon whether it's a
> solaris platform or win32 platform ?
>
> Regards,
> -Arun
>
> Erik Hatcher wrote:
>
> >I assume you mean for things like <copy> and <zip> and such.  Look into
tags
> >such as <condition> to set a property for a particular O/S type, and
using
> >if/unless on <patternset> to conditionally include/exclude files based on
> >existence of properties.
> >
> >    Erik
> >
> >
> >----- Original Message -----
> >From: "Arun Gupta" <ar...@sun.com>
> >To: <an...@jakarta.apache.org>
> >Sent: Thursday, April 25, 2002 7:23 PM
> >Subject: Platform specific extensions
> >
> >
> >>Hi,
> >>
> >>I have .sh and .bat files for a multi-platform product. How can I tell
> >>build.xml to pick up correct extension file on a particular platform ?
> >>
> >>Regards,
> >>-Arun
> >>
> >>
> >>
> >>
> >>--
> >>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> >>For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >>
> >>
> >
> >
> >--
> >To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> >For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
>
> --
> =============================================
> There is only one me, I must live myself!
> There is only one today, I must live itself!
> =============================================
> http://members.tripod.com/~apgupta/index.html
> =============================================
>
>
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Platform specific extensions

Posted by Erik Schalburg <er...@sumerduckva.com>.
It may be an unpopular opinion (it seems to be where I work), but I would
question first why you are calling scripts from ant.  Sure, there are places
where calling a script is a good idea, but I've seen build files that call
scripts that are persistent processes.  I've even seen people start app
servers with a target.  It may just be a pet peeve, but it seems to me that
that is not what Ant is supposed to be used for - one of those 'You can, but
should you?' kinda things.

Sorry for the rant... rough day.  I'd appreciate some other opinions.

<snip>
For example I have a product with scripts foo.sh and foo.bat. Now I want
to have an exec task in my build.xml such as:

<exec executable="foo.${property}">
    <arg line="some value">
</exec>

Can ${property} be set to ".sh" or ".bat" depending upon whether it's a
solaris platform or win32 platform ?

Regards,
-Arun
</snip>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Platform specific extensions

Posted by Arun Gupta <ar...@sun.com>.
For example I have a product with scripts foo.sh and foo.bat. Now I want 
to have an exec task in my build.xml such as:

<exec executable="foo.${property}">
    <arg line="some value">
</exec>

Can ${property} be set to ".sh" or ".bat" depending upon whether it's a 
solaris platform or win32 platform ?

Regards,
-Arun

Erik Hatcher wrote:

>I assume you mean for things like <copy> and <zip> and such.  Look into tags
>such as <condition> to set a property for a particular O/S type, and using
>if/unless on <patternset> to conditionally include/exclude files based on
>existence of properties.
>
>    Erik
>
>
>----- Original Message -----
>From: "Arun Gupta" <ar...@sun.com>
>To: <an...@jakarta.apache.org>
>Sent: Thursday, April 25, 2002 7:23 PM
>Subject: Platform specific extensions
>
>
>>Hi,
>>
>>I have .sh and .bat files for a multi-platform product. How can I tell
>>build.xml to pick up correct extension file on a particular platform ?
>>
>>Regards,
>>-Arun
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>

-- 
=============================================
There is only one me, I must live myself!
There is only one today, I must live itself!
=============================================
http://members.tripod.com/~apgupta/index.html
=============================================





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Platform specific extensions

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
I assume you mean for things like <copy> and <zip> and such.  Look into tags
such as <condition> to set a property for a particular O/S type, and using
if/unless on <patternset> to conditionally include/exclude files based on
existence of properties.

    Erik


----- Original Message -----
From: "Arun Gupta" <ar...@sun.com>
To: <an...@jakarta.apache.org>
Sent: Thursday, April 25, 2002 7:23 PM
Subject: Platform specific extensions


> Hi,
>
> I have .sh and .bat files for a multi-platform product. How can I tell
> build.xml to pick up correct extension file on a particular platform ?
>
> Regards,
> -Arun
>
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>