ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ditrick, Gregory" <gregory.ditr...@fmr.com>
Subject RE: for task with inline exec?
Date Mon, 20 Aug 2007 15:31:07 GMT
Not a bad idea to use <ac:shellscript>, if you are not doing cross
platform stuff.
The use of a lot of this type of thing, <ac:shellscript>, can make the
ant script platform dependent or you will require additional products
like Cygwin for Windows.

Using redirectors can make this type of thing platform independent.
But, I've found that you usually have to use intermediate flat files to
re-create all the pipes.  This then has the cost of I/O, but gives you
an the desired platform independent scripts.

So, you have to weigh the solution with big picture.  If you are never
ever going to another platform like Microsoft then definitely use the
<ac:shellscript> task.  If there is any chance of going to Microsoft use
redirectors and intermediate files.

Using intermediate files then you use the <exec> task with a command in
a property like ${os.filedump.cmd} and redirectors to get your desired
output.  In a os specific properties file you'll set os.filedump.cmd to
the desired command: i.e. cat for unix, type for windows, etc.  A lot
more work, but will save you a lot of time if you have to move your
script from Unix to Windows.  And then you are not dependent on Cygwin
being installed on the Windows box.

Again, you must weigh and see the big picture: if the ant script will
never ever be ran on Windows, then use <ac:shellscript>.  Or, you'll be
okay if having Cygwin install on the Windows box is not a big burden
(lots of boxes or don't have admin rights on all Windows' boxes).

My 2 cents on the subject.   

Keep smiling,

GregD
6-8309

-----Original Message-----
From: Vihan Pandey [mailto:vihanpandey@gmail.com] 
Sent: Monday, August 20, 2007 10:35 AM
To: Ant Users List
Subject: Re: for task with inline exec?

> Why not use shellscript?

didn't think of it :-)

---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<------
-8-<----

<shellscript shell="bash" outputproperty="js.list">
     cat deploy.properties | grep .js-version| sed
s/.js-version=v.[0-9]*/,/g | tr -d '\n' | sed s/,$//g
</shellscript>

<echo>JS list: ${js.list}</echo>

        <for list="${js.list}" param="myval">

          <sequential>
<replace dir="${docroot-re01}" token="/javascripts/@{myval}.js"
value="http://js.cleartrip.com/javascripts/@{myval}.${@{myval}.js-versio
n}.js"
>
<include name="**/*.html"/>
<include name="**/*.shtml"/>
</replace>
          </sequential>
        </for>

---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<------
-8-<----

Now it works beautifully :-)

Thanks a million Jan and Peter !!!

Regards,

-vihan

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




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


Mime
View raw message