ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <bi...@progress.com>
Subject Re: Reusing <patternset> with a subset?
Date Wed, 06 Dec 2000 19:06:11 GMT
Hi Stefan,

Stefan Bodewig wrote:
> 
> 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?

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.

> 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.

That would be something to consider.  

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

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.  The other option I like a little better is
to have the master build.xml copy all the .properties files to a known
location.  Then each sub-build.xml would only copy what it needs based on
its patternset.

> Stefan

Thanks,
-Bill Burton

Mime
View raw message