Bug 20485

Summary: The <sync> task doesn't support the nested "filterset" element
Product: Ant Reporter: Gu Dev <devgu>
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: enhancement    
Priority: P3    
Version: 1.7.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Gu Dev 2003-06-04 21:08:45 UTC
My buildfile used to <copy> the scripts files to the
dist directory. After changing the file names
in my scripts dir, the old file were not
deleted when I build. I want to use the <sync> task but 
it doesn't support <filterset> which I use in the <copy>.
I can't use the <filter> task as well since <sync> doesn't
support the filtering attribute.

Here is my dist target:

    <target name="dist" depends="pack"
            description="--> Make a lite-dist of the project">

        <!-- Distribute the lib directory -->
        <mkdir dir="${dist.lib.dir}"/>
        <sync todir="${dist.lib.dir}">
            <fileset dir="${build.lib.dir}"/>
        </sync>

        <!-- Distribute the bin directory -->
        <mkdir dir="${dist.bin.dir}"/>
        <pathconvert targetos="windows" 
                     property="server.rt.classpath.text" 
                     refid="server.rt.classpath">
            <map from="${basedir}\${dist.lib.dir}" to="..\lib"/>
        </pathconvert>
        <sync todir="${dist.bin.dir}">
            <fileset dir="${scripts.dir}"/>
            <filterset>
                <filter token="SERVERCP" value="${server.rt.classpath.text}"/>
                <filter token="SERVERMAIN" value="${server.main.class}"/>
            </filterset>
        </sync>

    </target>

- Gu
Comment 1 Dominique Devienne 2003-06-04 21:55:16 UTC
Sorry, but this was by design...

I thought at the time that supporting <filterset> would force keeping track of 
the info used to do replacements, otherwise that info could change, and <sync> 
wouldn't know about it, so stale files would exist in the target directory (not 
good!).

OTOH, <copy> is probably already affected with this behavior...

So I guess it comes down to: I needed <sync>, but not with replacement. It 
wasn't my itch ;-)

If it's yours, I invite you to contribute a patch ;-) --DD