[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ant-user
Subject:    Re: Is it possible to run a target for each file in a fileset?
From:       "Andy Stevens" <insomniacpenguin () googlemail ! com>
Date:       2008-06-26 10:04:11
Message-ID: efe2a0400806260304t1da9b7anf2374d2e293794e3 () mail ! gmail ! com
[Download RAW message or body]

2008/6/24 Rebhan, Gilbert <Gilbert.Rebhan@huk-coburg.de>:
> -----Original Message-----
> From: Andy Stevens
...
>>  I haven't found a way to combine the echo & java commands into a
>> single command line (separating them with ; just makes it ignore the
>> second command) so I'm wondering if it's possible to loop over the
>> fileset and call a separate target (containing <echo> and <java>
>> tasks) for each one in turn, passing the filename in a
>> property/parameter?  Kind of like a cross between the <apply> and
>> <ant>/<antcall> tasks.
>>
>> Is that possible, or is the batch file going to be the easiest way to
>> do what I need?  Or can anyone suggest another way I've not thought
>> of?
>
> maybe with <for> task from antcontrib =
>
> <fileset dir="..." includes="yourpattern" id="yourID"/>
>
> <for list="${toString:yourID" param="filename">
>  <sequential>
> <echo>... process file => @{filename}
>
>  your <java ...> call goes here with @{filename} as input
>
>  </sequential>
> </for>

Thanks, everyone, for the suggestions.  Sounds like <for> is probably
the way to go - I found a build script from another of our projects
that already uses it (looks like Netbeans' mobility pack includes the
ant-contrib jar, and luckily I did include that option when I
installed it).

Another possiblity I was wondering about, given jslint is itself
written in javascript, was using the <script> optional task to run it
rather than calling Rhino.  Ideally, I'd use the src attribute to read
in an unmodified jslint.js then some inline javascript to set up
various options and call it.  Can that be done in a single <script>
task, though? i.e. would it read/execute the external src file and
then execute the inline script as well?  Or, if I use more than one
<script> task in a target (one using src, one with the inline script)
would the objects/functions defined in the first one still be
available in the subsequent task or does each one run in a completely
separate/clean context?


Andy.
-- 
http://pseudoq.sourceforge.net/  Open source java Sudoku application

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic