> Oh, and how about "stale" files. I mean, if I vppcopy a file, then
> delete the original vpp, is the filtered resulting java file still
> there? IIRC there was a lsync task floating around that synched
> correctly, maybe a vppsynch could be the *final* solution?

Yes, if you use <vpp> (see vpp.sourceforge.net), to preprocess .java.vpp
files to .java files, and then delete a source .java.vpp, the corresponding
.java file becomes 'stale' as you describe and will sit in your gen
directory until it is cleared out.  This is also true with <vppjavac>.
Another artifact of not having preprocessing integrated into JavaTM :(

It's funny you should ask this.  The other night I spent a couple hours
thinking about this and before realizing that ant can better do this already
without any additional work on vpp's part.

Generally, it's easy enough to clean the gen directory completely and
rebuild, thus purging any stale files, along with everything else.  But if
for some reason you don't want to purge everything, then a combination of
<delete>, <fileset>, <present>, <mapper> and will remove the stale files
nicely.

I've never actually needed to do this before, but just for fun, I created an
example that shows how such a purge of stale files might be done:

<project name="purge" default="purge" basedir=".">
    <target name="purge">

        <mkdir dir="gen"/>
        <mkdir dir="src"/>
        <echo file="gen/deleteme.java" message="Delete me!"/>
        <echo file="gen/foo.java" message="Don't delete me!"/>
        <echo file="src/foo.java.vpp" message="Don't delete me!"/>
        <delete>
            <fileset dir="gen" includes="**/*.java">
                <present present="srconly" targetdir="src">
                    <mapper type="glob" from="*.java" to="*.java.vpp"/>
                </present>
            </fileset>
        </delete>
    </target>
</project>

didge

Reply via email to