ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/types DirSetTest.java
Date Fri, 05 Apr 2002 13:05:59 GMT
On 4 Apr 2002, <conor@apache.org> wrote:

>   I'm not sure why you can't pass a <dirset> to a <fileset> by
>   reference.

because the result would be counterintuitive.

<dirset id="dirs" dir="." />

is supposed to contain all directories under basedir.

<jar>
  <fileset refid="dirs" />
</jar>

will include all files, including the directories will happen by
accident.

The problem is, that FileSet doesn't really encapsulate files, but
only a DirectoryScanner - and it is up to the task to decide whether
they want to use the files or directories or even both.

If you pass a dirset as a fileset to a task that is not aware of the
DirSet class (read, all tasks except pathconvert), they will use
getIncludedFiles().

An ugly(? - yes, I think it would be ugly) hack to make dirset work
like ones expectation would be to override getDirectoryScanner in
DirSet so that it returns a DirectoryScanner that was a wrapper around
the DirectoryScanner returned by FileSet and reroutes get*Files to
get*Directories and vice versa.  That way, tasks would call
getIncludedFiles and get the directories instead.

Stefan

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message