You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jo...@mail.sprint.com on 2001/06/11 18:35:55 UTC
RE: Foreach task)
an interesting twist to this is the case where you want your build.xml
to describe an environment where the fileset is an arbitrary number,
which is not necessarily known at the time of buildfile authoring, or
else has to be flexible.
For instance, using the FTP task to deploy the results of the build to
all servers in a cluster...the build process itself doesn't change when
you add another server to the cluster. In this case the for-each
<fileset...> description is very elegant. Hard-coding for every case
(unrolling the loop) is absurd, and masking the deployment action off
with a custom tag actually DECREASES the level of description of the
build itself.
How is the "right" way to handle a situation like this?
If it comes down to running a build by hand for each server, what's the
big advantage in using Ant in the first place, over say a BAT file?
Regards,
John
-----Original Message-----
From: asr [mailto:asr@ufl.edu]
Sent: Monday, June 11, 2001 11:17 AM
To: ant-user
Cc: asr
Subject: Re: looping (RE: Foreach task)
=> On Mon, 11 Jun 2001 23:06:34 +1000, Peter Donald
<do...@apache.org> said:
[...]
> 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).
OK, this feels to my ant-naive perceptions like a case of what I
quoted. I'll
spit out a straw man, and tell me where I'm missing your point?
<fileset name="tld-targets">
<30 taglib names/>
</fileset>
<target t0>
<compile a big load of stuff/>
</target>
<target t1 depends="t0">
<frobtaglib>
<mytargetsref="tld-targets"/>
<!-- Frobtaglib identifies a set of source/target mappings inferred
from
the target fileset. Let's say it makes .jar s -->
</frobtaglib>
</target>
<target t2 depends="t1">
<twiddletaglib/>
<mytargetsref="tld-targets"/>
<!-- And so on -->
</twiddletaglib>
</target>
The critical difference is:
(forall $Thing: T1,T2,T3)
vs.
(forall $Thing: T1)
(forall $Thing: T2)
(forall $Thing: T3)
I assert that, for any real case of T1,T2,T3 it is possible to 'phrase'
the
goal in either idiom. I welcome attempts at counterexamples. The
complexities
and pitfalls of the "transform sets of files" are different than those
of the
"run scripts on individual files". But I bet they are in fact provably
equivalent.
...
And one of them is ant-y. The other one is anti-ant-y.
- Allen S. Rout