ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kuiper, Arnout" <>
Subject [PROPOSAL] Directory scanning into a helper class (reuse + improv ement)
Date Fri, 21 Jan 2000 14:26:39 GMT

After updating the manual last night (and a number of questions
regarding Ant in my mailbox), I came to the conclusion that the
inclusion/exclusion of sets of files, is done separately by a bunch of
tasks, and could be improved a lot.

A lot of tasks have a base-directory, and a set of items that should
be included. Sometimes there is also an ignore attribute, to ignore
files/directories that have a certain name. Couldn't this be
standardized, made more flexible, etc...

I developed a helper class that given a basedir, a set of include
patterns and a set of exclude patterns, scans the given basedir, for
files that match one of the include patterns, and don't match any of
the exclude patterns. As a result the set of valid files is returned.

It could be used easily in the following tasks:
-copydir (inclusion/exclusion of files to copy)
-jar     (inclusion/exclusion of files to jar)
-javac   (inclusion/exclusion of files to compile)
-zip     (inclusion/exclusion of files to zip)

Also the creation of new tasks, that are based on a directory
structure, is much simpler.

-Tasks behave the same for the user.
-Easier to document in the manual.
-Better pattern matching.
-Less duplicated code.

Pattern matching is based on UNIX pattern matching. Matching is done
per directory name (name between two separators). In the pattern for
such a name, the following special characters can be used:
* matches zero or more characters
? matches one character
When the pattern for a directory name is '**', it matches zero or more
So "**/?d*.java" matches "", "test/",
"d1/d2/", but not "" (no 'd') and "test/xd.bat"
(no '.java').

What do you think of this?

Arnout Kuiper

View raw message