ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Lévy-Lambert <anto...@antbuild.com>
Subject Re: Inverting patternsets
Date Sat, 28 Feb 2004 23:29:03 GMT
David Corbin wrote:

>Since a partern set is a bunch of inclusions/exclusions, I think it would be 
>nice to be able to say "exclude everything that is in this patternset".
>
>I'll often define an inclusion-based patternset, that I would like to use to 
>create (for example) a jar.   Then I want to exclude those very same thing in 
>creating another jar.
>
>Is there any way to do this?
>  
>
Hi David,

being able to negate a patternset seems to be on the wish list of 
several people.

Ant does not offer this possiblity, but there is a very similar 
possibility using selectors :


<selector id="prodclasses">
   <or>
      <filename name="org/foo/prod/**.class"/>
  </or>
</selector>

<!-- select all the prodclasses -->
<fileset dir="classes">
     <selector refid="prodclasses"/>
</fileset>

<!-- select all the other classes (may be testcases, ...) --->
<fileset dir="classes">
      <not>
           <selector refid="prodclasses"/>
       </not>
</fileset>

The <filename/> selector is very similar to patternsets, but can be 
combined with logical operators <or>, <not>, <and>.
Also the scanning of filesets containing very specific patternsets such 
as <include name="some/very/long/long/path"/> is optimized
The use of selectors does not provoke any optimization, in the absence 
of specific include patternsets, ant scans a whole directory,
storing into an array the files which match the selector conditions.

Cheers,

Antoine


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message