ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@bost.de>
Subject Re: Combining PatternSets with Path elements
Date Fri, 10 Nov 2000 09:23:33 GMT
Matt Conway <Matt_Conway@i2.com> wrote:

> Sort of.  What I had in mind was the following:
> 
> <patternset id="packages">
>   <include name="com/foo/util/*" />
>   <include name="com/foo/bar/*" />
> </patternset>
> 
> <target name="some_other_task">
>      <!-- I want this task to copy all *.foo files elsewhere, but
>      can't
> figure out
>      how to make the copy task only look for *.foo files, and not
>      others.
> -->
>      <copy todir="outputdir">
>           <fileset>
>                <patternset refid="packages"/>
>           </fileset>
>      </copy>
> </target>

The problem is, that includes are additive (something that comes in
handy when defining the first patternset) and there is no way to
restrict them with another include. 

The only thing you can do, is restricting them by using an exclude
pattern (which means you'll need to specify the things you don't want
to copy and know the upfront).

      <copy todir="outputdir">
           <fileset>
                <patternset refid="packages"/>
                <patternset>
                        <exclude name="**/*.baz" />
...
                        <exclude name="**/*.java" />
...
                        <exclude name="**/*.zapp" />
                </patternset>
           </fileset>
      </copy>

or have separate patternsets

<patternset id="packages.foo">
  <include name="com/foo/util/*.foo" />
  <include name="com/foo/bar/*.foo" />
</patternset>

Stefan

Mime
View raw message