ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Reusing <patternset> with a subset?
Date Thu, 07 Dec 2000 09:12:16 GMT
Bill Burton <billb@progress.com> wrote:

> Stefan Bodewig wrote:
>
>> This issue has come up before and we've not found a good solution
>> for it, maybe a new <restrict> pattern type or something similar?
> 
> Yes, that sounds good.  I was thinking of something similar like
> <excludeunless> but <restrict> looks better.  Spent some time
> looking at the code to see how hard it would be to add.  Looks like
> it would touch a number of classes just to add to <fileset> and
> <patternset>.  Then to be consistent, a "restricts" attribute should
> probably be added to all the tasks that support includes and
> excludes.

Adding nested <restrict> elements everywhere where an <include> or
<exclude> can appear is not much of a problem, you'd have to change
DirectoryScanner significantly to make them do anything.

> In the meantime, is there any way to access a fileset object and
> manipulate it from a <script> or custom task?

Actually FileSet itself is a dumb class that doesn't do and doesn't
know anything - well almost. The work is done in DirectoryScanner and
you don't have easy access to this via <script>.

> In any case, it looks like a work around is to copy all the
> .properties files to a temporary directory and then use the
> patternset to copy from there to the desired location.

Yep. Another - extremely hacky - workaround for current CVS sources
would be:

<copy ...>
  <fileset ...>
    <patternset refid="selects.the.packages" />
  </fileset>
  <mapper type="glob" from="*.properties" to="*.properties" />
</copy>

which abuses the side effect of the mapper that all files that don't
match the from pattern will be dropped.

Stefan

Mime
View raw message