ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Possible Exec and MatchingTask Refactorings
Date Tue, 27 Jun 2000 09:34:24 GMT

Just wanted to collect some comments before I start implementing
anything with regard to the subject.

Some of the tasks derived from Exec could benefit from having
MatchingTask behavior (read work on several files at the same
time). Chmod and Cvs are two cases, Rmic which could be a subclass of
Java which in turn extends Exec might be another candidate.

It has been suggested to make Exec extend MatchingTask to account for
this. The two main reasons why I don't like this approach:

* There are at least three ways I could understand a file list provided
to a plain exec task:

(1) Run the command on each of the files - once per file - and always
add the filename to the command line (probably as the last argument).

(2) Run the command on all of the files at once - add all filenames as
arguments to the command line (probably as the last arguments).

(3) Run the filenames as the command to execute.

* We would add attributes to tasks that couldn't use them at all. What
would an exclude list mean to an Ant task? This is the same as deriving
Circle from Ellipse.

What I'd prefer to do is to reuse the functionality of MatchingTask
via delegation. A first draft idea to do so:

(a) Add an interface MatchingTaskBehavior with setIncludes,
createInclude ... methods.

(b) Create a non abstract class MatchingTaskImpl that doesn't extend
Task but otherwise implements MatchingTaskBehavior the same way
MatchingTask does right now.

(c) Make MatchingTask implement MatchingTaskBehavior and delegate all
methods from the interface to an instance of MatchingTaskImpl.

(d) Do the same for Cvs and Chmod.



View raw message