ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John.D.Ca...@mail.sprint.com
Subject RE: Foreach task)
Date Mon, 11 Jun 2001 20:40:46 GMT
I second all this! I am doing something almost identical to your build 
process, only I'm also supporting the ability to deploy to multiple 
environments for development, QA, and production, each with different 
fundamental server configs and different physical characteristics. It 
doesn't make sense to write a build file for each env, since that would 
be a maintenance nightmare, and there is no reasonable way to 
homogenize the environments. If I wrote homegrown tasks to support 
deployment (which involves building sets of property files unique to 
each server instance and THEN moving the files out), it would be 
impossible for my successor to understand without tearing apart my 
code. Additionally, to maintain such a build, the next person HAS TO 
KNOW JAVA, and has to be familiar with developing against the Ant API. 
This simply isn't acceptable. Therefore, as far as I can see, the 
foreach is necessary from a practical point of view.

Also, I'd like to make another point, however feeble:

If you have a pure tool that is relatively useless, what's the point? 
If you want to ensure that tool's survival into the future (which 
everyone does; else why waste time on it?) you have to make it useful. 
And supporting trivial builds that could be done *very* easily with a 
twelve-year-old's shell script is not what people in enterprise 
situations would consider useful.

Just my 2 cents.

Regards,
John

-----Original Message-----
From: christopher.berry [mailto:christopher.berry@etrade.com]
Sent: Monday, June 11, 2001 3:19 PM
To: ant-user
Subject: RE: looping (RE: Foreach task)


Greetings,

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

In my current build, I have used <foreach> three times, and I do not 
see an
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 
supplied
property. I do not think one could do this generically w/ the current 
Ant
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 
shared
common-build.xml. But we must also provide a generic "full build" 
procedure,
which can build an unknown set of Apps. Of course, one could require 
that
full-build.xml be edited whenever Apps were added or deleted, but 
wouldn't
that be error-prone?? To me this would be similar to explicitly adding 
JARs
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 
specific
pattern, and pass it off to another Task. In this case, a home-grown 
Task
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 
subsequent
Ant Task.

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

Cheers,
-- Chris
 

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message