ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bian Tan <b...@avolent.com>
Subject RE: Reusing <patternset> with a subset?
Date Wed, 06 Dec 2000 17:38:40 GMT

I too have this problem,
how about this for a suggestion for an relatively clean Ant enhancement:

Add a boolean 'inverse' attribute to the include and exclude tags.  This
would reverse the files matched by pattern provided by the name attribute of
these tags.  The 'server' patternset could be extended by adding an:
<exclude name="**/*.properties" inverse="true" /> 

e.g.
     <copy todir="${classes.dir}">
       <fileset dir="${src.dir}">
         <patternset refid="server">
           <!-- further refine to .properties files only -->
           <exclude inverse="true" name="**/*.properties" />
         </patternset>
       </fileset>
     </copy>

This should effectively double the expressive value of the <include> and
<exclude> tags providing fuller coverage.
I haven't looked at the code, but this should be a relatively simple
function to add since the basic pattern matching is already there, just
simply ! (not) it.

-Bian Tan

-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org]
Sent: Wednesday, December 06, 2000 6:39 AM
To: ant-user@jakarta.apache.org
Subject: Re: Reusing <patternset> with a subset?


Bill Burton <billb@progress.com> wrote:

>     <copy todir="${classes.dir}">
>       <fileset dir="${src.dir}">
>         <patternset refid="server">
>           <!-- only include files found in the patternset -->
>           <include name="**/*.properties" />
>         </patternset>
>       </fileset>
>     </copy>
> 
> Is there any way to do the above?  
> 

Unfortunately no. The includes as well as the excludes are additive
and I file matches a patternset if it matches at least one include
pattern and no exclude pattern.

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?

Currently we only support set unions (this applies to filesets or
pathelements as well) by simply specifying more than one element -
maybe we need a general set intersection mechanism, I'm not sure.

Stefan

Mime
View raw message