For the record, here is how I implemented the whole creation and
deletion of * files which have a corresponding sample.* file (see attached
text file)....


Thanks to Diane Holt, Dominique Devienne, and Stefan Bodewig for all
the help!

Jake
<target
    name="sample.init" >
    <!-- description="Copy sample files if they don't exist" -->

    <copy todir="${src.dir}" >
        <fileset dir="${src.dir}">
            <present present="srconly" targetdir="${src.dir}">
                <mapper type="glob" from="sample.*" to="*" />
            </present>
        </fileset>
        <mapper type="glob" from="sample.*" to="*" />
    </copy>

    <filter token="context.docbase" value="${root.dir}" />
    <filter token="context.path" value="${app.path}" />
    <filter token="log4j.system.variable.dynamic.name" 
value="${log4j.system.variable.dynamic.name}" />
    <copy todir="${build.dir}" filtering="true" >
        <fileset dir="${build.dir}">
            <present present="srconly" targetdir="${build.dir}">
                <mapper type="glob" from="sample.*" to="*" />
            </present>
        </fileset>
        <mapper type="glob" from="sample.*" to="*" />
    </copy>

</target>

<target
    name="sample.clean"
    depends="sample.clean.src, sample.clean.build"
    description="Clean up files gerated via sample.init" />

<target
    name="sample.generate.fs.src.copies" >
    <!-- description="Conditionally create the sample.fs.src.copies property 
containing a comma separated list of existing '*' files resulting from a fileset 
containing corresponding 'sample.*' files. Property not set if result is empty." -->

    <fileset dir="${src.dir}" id="sample.fs.src">
        <present targetdir="${src.dir}">
            <mapper type="glob" from="sample.*" to="*" />
        </present>
    </fileset>

    <pathconvert pathsep="," property="sample.fs.src.copies" setonempty="false" 
refid="sample.fs.src">
        <map from="${src.dir}${file.separator}sample." to=""/>
    </pathconvert>

    <!--<echo message="${sample.fs.src.copies}"/>-->

</target>

<target
    name="sample.generate.fs.build.copies" >
    <!-- description="Conditionally create the sample.fs.build.copies property 
containing a comma separated list of existing '*' files resulting from a fileset 
containing corresponding 'sample.*' files. Property not set if result is empty." -->

    <fileset dir="${build.dir}" id="sample.fs.build">
        <present targetdir="${build.dir}">
            <mapper type="glob" from="sample.*" to="*" />
        </present>
    </fileset>

    <pathconvert pathsep="," property="sample.fs.build.copies" setonempty="false" 
refid="sample.fs.build">
        <map from="${build.dir}${file.separator}sample." to=""/>
    </pathconvert>        

    <!--<echo message="${sample.fs.build.copies}"/>-->

</target>

<target
    name="sample.clean.src"
    depends="sample.generate.fs.src.copies"
    if="sample.fs.src.copies"
    description="Clean up files in the src dir generated via sample.* templates" >

    <delete quiet="true">
        <fileset dir="${src.dir}" includes="${sample.fs.src.copies}" />
    </delete>

</target>

<target
    name="sample.clean.build"
    depends="sample.generate.fs.build.copies"
    if="sample.fs.build.copies"
    description="Clean up files in the build dir generated via sample.* templates" >

    <delete quiet="true">
        <fileset dir="${build.dir}" includes="${sample.fs.build.copies}" />
    </delete>

</target>
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to