Bug 32632

Summary: pattern / nested patternset in filterset
Product: Ant Reporter: Holger Engels <hengels>
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: REOPENED ---    
Severity: enhancement    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description Holger Engels 2004-12-10 14:06:08 UTC
filters / filterchains / filterreaders should all allow for patterns and nested
patternsets.

<copy todir="${deploy.dir}">
  <fileset refid="webapp"/>
  <filterset>
    <filter token="DATE" value="${TODAY}"/>
    <patternset id="sources">
      <include name="**/*.xml"/>
    </patternset>
  </filterset>
</copy>

This should apply the filters of the filterset only to files of the fileset
matching the patterns of the patternset.
Comment 1 Matt Benson 2004-12-10 17:10:58 UTC
You can do this with multiple copy tasks.
Comment 2 Holger Engels 2004-12-13 08:29:09 UTC
(In reply to comment #1)
> You can do this with multiple copy tasks.

I can use multiple coüpy tasks only, if I am the one, who defines the fileset.
Unfortunately, I'm not. The fileset is an artifact, exported by another module.

The documentation of filtersets says "copy operations will typically corrupt
binary files". But there's no straight forward way to avoid that. Imagine you
write a deploy target, that copies filesets to a deployment directory and
thereby weaves the configuration into the deployables. From the perspective of
the target, filesets are logical units. The target should be unconcerned about
the fileset's internals.

.. just wanted to state my thoughts. I won't reopen the issue again.
Comment 3 Matt Benson 2004-12-13 16:52:22 UTC
It still sounds as though you could work around this using multiple copy
operations if you had the ability to use an existing fileset as a template for a
more-specific fileset, per your other bug report, correct?
Comment 4 Holger Engels 2004-12-14 10:43:56 UTC
Correct. Then I could write something like:

<copy todir="${deploy.dir}">
  <fileset inherit="webapp">
    <include name="**/*.xml"/>
  </fileset>
  <filterset>
    <filter token="DATE" value="${TODAY}"/>
  </filterset>
</copy>
<copy todir="${deploy.dir}">
  <fileset inherit="webapp">
    <exclude name="**/*.xml"/>
  </fileset>
</copy>