ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Vogel <pvo...@arsin.com>
Subject RE: Foreach task)
Date Mon, 11 Jun 2001 17:46:34 GMT
> 
> 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.

My point exactly!!!  Glad to hear I'm not a lone voice in the wilderness
on this one...

> 
> 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?


The *right* way would be for a couple of terms that are used anytime a 
human describes a build process to find their way into the ant core:
	foreach, if

Not as a "scripting" word, but as a descriptive word, for example:
	foreach of the tarballs in this dir, ftp and untar them on 
	each of the machines listed.
	
Note that "out of dateness" may or may not be an aspect of the desired 
iteration.  For example, in the case of exploding a tarball, its probably
more useful to explode the tarball and not check whether every file in the
exploded directory is already up to date w.r.t. the contents of the tarball,
in other cases uptodate checking might be desireable.  

-Peter
> 
> -----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 
> <donaldp@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
> 

Mime
View raw message