ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@apache.org>
Subject Re: looping (RE: Foreach task)
Date Mon, 11 Jun 2001 13:06:34 GMT
At 08:02 AM 6/11/01 -0400, asr@ufl.edu wrote:
>So:  What is the essence of 'iteration' for the purpose of this debate?

"iteration" for the purpose of this debate is something like <foreach
.../>. Some people try to confuse the definition to serve an agenda or
because of hangups from other build systems (ie make).

>I define a set of input files Si, a set of corresponding output files So, and
>a process trans(Fi) by which an individual Fi may be transformed to Fo, and
>let ant figure out where it's necessary.
>
>Is that iteration?

nope - but good (GNU)make practices would implement this as iteration.

>I define a set of input files Si, a function up-to-date(Fi) to tell if an
>individual Fi has been processed, and a process trans(Fi) to do the right
>thing (perhaps untar, jar, whatever)
>
>Is that iteration?

nope - see above ;)

Both of the above would be best implemented as tasks. In Ant1 it is a PITA
to do as there is little core support for writing such things and keeping
separate task libraries is also painful. In Ant2 we have decided to build a
"framework" so that implementing a task to do above will be trivial.

However the usecase that ant needs is executing the same set of tasks with
different parameters. ie Repeat tasks t1 -> tn with different values for A,
B and C properties. It is really useful when you need to repeate the set of
operations over a large number of datasets (ie if you have 30 taglibs that
all require same steps to generate compile and deploy etc).

Essentially in this facility the foreach is acting as a generic target with
a (possibly dynamically generated) list of input parameters. The reason
people ask for this is essentially because ant is not designed to have
generic rules.  People have implemented them as hacks via antcall/ant/dtd
includes/etc but in general this increases cost of maintaining project.

Since everyone seems to be an "expert" on this subject, it is likely that
no mechanism will be included in core. You will have to go to other places
(ie proposed taskdefs.org or perhaps sourceforge) to pick it up.

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Mime
View raw message