ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "didge" <>
Subject RE: Javac task design problems
Date Tue, 25 Feb 2003 00:05:12 GMT
> 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, 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

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/" message="Delete me!"/>
        <echo file="gen/" message="Don't delete me!"/>
        <echo file="src/" message="Don't delete me!"/>
            <fileset dir="gen" includes="**/*.java">
                <present present="srconly" targetdir="src">
                    <mapper type="glob" from="*.java" to="*.java.vpp"/>


View raw message