ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: Is it possible to run a target for each file in a fileset?
Date Tue, 24 Jun 2008 11:51:05 GMT
 


-----Original Message-----
From: Andy Stevens [mailto:insomniacpenguin@googlemail.com] 
Sent: Tuesday, June 24, 2008 1:40 PM
To: user@ant.apache.org
Subject: Is it possible to run a target for each file in a fileset?

/*
[...]
The only problem with the above is that jslint.js doesn't output the
filename of the file it's processing, so if more than one javascript
file produces warnings, all I get is a bunch of line & column numbers
with no clue as to which of the problems are in which file(s) :-(  So
before it runs jslint each time I want to print the filename.  I
suppose I could create a batch file to do this (containing an echo and
the above java command, each with %1 in their arguments) and have
<apply> call that, but I'd rather do it in the Ant script if possible.
 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>


Regards, Gilbert


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


Mime
View raw message