ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Vogel <>
Subject RE: looping (RE: Foreach task)
Date Mon, 11 Jun 2001 20:38:44 GMT
Hi Chris,

I don't think I've devolved to the point of religeon yet, and
I've actually been pleased with the level at which discussion
here (and in private) has been happening.

But yep, I agree!


-----Original Message-----
From: Christopher Berry
To: ''
Sent: 6/11/2001 1:18 PM
Subject: RE: looping (RE: Foreach task) 


As the one who (innocently) began this debate, I will chime in. Although
suspect that this argument has become religious, and as such, neither
is listening to the other anymore...

In my current build, I have used <foreach> three times, and I do not see
alternate approach. 

1) Loop over all TAR.GZ files in a directory and unpack them -- using a
generic unpack-GZfile-build.xml which takes the base filename as a
property. I do not think one could do this generically w/ the current
Tasks, or at least I couldn't figure it out.

2) Loop over every subdir in a directory and call it's build.xml file
(if it
exists). Our Apps build independent of each other -- calling into a
common-build.xml. But we must also provide a generic "full build"
which can build an unknown set of Apps. Of course, one could require
full-build.xml be edited whenever Apps were added or deleted, but
that be error-prone?? To me this would be similar to explicitly adding
to a Classpath, rather than just implicitly adding all JARs in the /lib
directory. One way requires no future intervention, the other constantly
bites you...

3) Loop over every file in a particular directory that matches a
pattern, and pass it off to another Task. In this case, a home-grown
which pulls a Version number from the filename, determines the maximum
Version number in use, and writes it to a property for use in a
Ant Task.

Obviously I could have written a home-grown Task for each of these
instances. But where is the elegance in that?? Isn't "Don't Repeat
one of the cardinal rules of development. 

-- Chris

View raw message