ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: looping (RE: Foreach task)
Date Tue, 12 Jun 2001 05:53:27 GMT
It's a little silly to have the same discussion on two different lists
with slightly different sets of people ...

I don't want to argue iteration in general here, just look into
Christopher's usecases.

Christopher Berry <> wrote:

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

Should be possible with <execon>:

<execon executable="tar">
  <arg value="xzf">
  <srcfile />

  <fileset dir="mydir" includes="*.tar.gz" />

But you wouldn't be using the built in tar and gzip tasks but have to
rely on the command line tools being installed.

> 2) Loop over every subdir in a directory and call it's build.xml
> file (if it exists).

Not possible without a custom task in Ant 1.3, <anton> in Ant2 will be
your friend.

> 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 [...]

As you are using a home-grown task anyway, you could make that task
support filesets directly - which in turn would probably increase
performance as well as you'd just have to configure this task once
instead of once per file.


View raw message