ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: executing task for each file in file set
Date Tue, 12 Jun 2001 13:42:20 GMT
Peter Vogel <pvogel@arsin.com> wrote:

> I guess my point is that "bad practices" will happen, no matter what
> you do to prevent them.

Agreed.

> I challenge you to describe what a number of core and/or official
> optional tasks do without using the words for, each and if.

<echo> writes a message to Ant's logging system ;-)

Too me most tasks don't iterate but operate on sets, so I actually can
describe lots of tasks without using for in the sense of iteration:

<copy> copies a subset of the files given by the nested <fileset>
elements to the directory given in the todir attribute.  The subset
consists of those files that are newer than their corresponding
targets.

I know that the difference is just a small one, but I don't think
"iteration" when I talk about most tasks that accept filesets.

<execon> is a different beast.  As long as you say parallel="false",
we are talking about iteration, but this nice little parallel
attribute makes all the difference - you can transform a whole set of
files at once, without any iteration.  <execon> is a little more than
just <foreach> and <exec> nested into a single task.

This is not taking away anything from the argument that iteration can
be used to describe what you want to do.

>> In the meantime Ant has gathered some other quite popular tasks
>> that show what could be done with tasks - ejbjar and junit are
>> quite prominent examples.
> 
> Haven't had a need for them yet.  I find it interesting that the
> examples most often cited for best meeting the goals of ant are not
> a part of the "core" and are very special-purpose (one is
> exclusively for use with WebLogic based projects, the other is based
> on a testing framework).

It has been a long time that <ejbjar> has been a Weblogic only tool,
it now supports a whole bunch of EJB containers.

JUnit is extremely popular (especially outside the open source
community).  Using Ant you can enforce a "no commit without running
the unit tests" policy - which possible with other build as well, but
gives you the integration for free.

> That said, they both look like good examples of appropriate use of
> ant's extensibility, there are others in the optional library that
> look like good examples of someone prefering to write a java task
> than to use the "<exec>" tag.

But even if they are just that, they provide a convenience layer on
top of exec for the uninitiated.  I've never used any source control
system apart from cvs and PVCS, but I think I could start using many
of them without reading the documentation - solely relying on the Ant
tasks.

And then, things that start out as convenience layers may be expanded
to become much more than that at some point of time ...

Stefan

Mime
View raw message