ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: for task with inline exec?
Date Mon, 20 Aug 2007 16:39:11 GMT
Ant knows it is on windows and uses backslashes when storing
filenames in properties and paths.
These cause havoc if used in scripts for example:

<ac:bash>
  ls -rtla ${basedir}
</ac:bash>

there are ways to work around this, however, they are usually not
worth it.

Pter

On 8/20/07, Ditrick, Gregory <gregory.ditrick@fmr.com> wrote:
> Peter,
>
> Sorry, I have not used Cygwin and ant in awhile, so forgive me on these questions.  But,
can ${file.separator} work for backslashes?  Wouldn't ant translate ${file.separator} for
you in the case you are running ant in Cygwin?  Could you do ${file.separator}${file.separator}
in case you have to escape the backslash for bash and still be platform independent on a Windows
box?
>
> I try to avoid these types of things and usually avoid being dependent on Cygwin.  I
use redirectors all the time on both platforms of Windows and Unix.  Maybe I just don't see
the initial problem through the forest.  I was just throwing out that <ac:shellscript>
does make an ant script UNIX dependent unless something has changed with newer releases that
I'm not aware of.
>
> Later,
>
> GregD
> 6-8309
>
> -----Original Message-----
> From: Peter Reilly [mailto:peter.kitt.reilly@gmail.com]
> Sent: Monday, August 20, 2007 12:02 PM
> To: Ant Users List
> Subject: Re: for task with inline exec?
>
> Even with cygwin, there are big issues with using
> bash on windows. The main issue is the
> **!!?%%££€€$$!!!*! backslashes characters for directories.
>
> Peter
>
> On 8/20/07, Ditrick, Gregory <gregory.ditrick@fmr.com> wrote:
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> 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