ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@us.ibm.com
Subject Re: Any objections against advanced directory scanning?
Date Sat, 29 Jan 2000 13:54:32 GMT


Costin wrote:

> Can you repeat the proposal, I can't find the mail...

I believe that below is the original e-mail.

+1 by the way - it would be an excellent addition.  I find the "**" syntax
a bit odd, but I don't have a better suggestion.  In any case, this is much
more usable and appropriate than regular expressions (Arnout's original
proposal).

- Sam Ruby

"Kuiper, Arnout" wrote:

> 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.
>
> Advantages:
> -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
> directories.
> So "**/?d*.java" matches "xdyz.java", "test/ad.java",
> "d1/d2/pdxxx.java", but not "x.java" (no 'd') and "test/xd.bat"
> (no '.java').
>
> What do you think of this?
>
> Arnout Kuiper



Mime
View raw message