ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Cook <tc...@ardec.com.au>
Subject WIBNI for Javac Task
Date Mon, 03 Jul 2000 23:31:38 GMT
I was under the impression that ant found each source file, and worked
out where the destination file would end up, and then do comparisons
on them. This works fairly faultlessly for me - are you using the 3.1
release, or the latest CVS source? The release is hopelessly out of date...

Regards
Tom

FUSSI@de.ibm.com writes:
 > 
 > 
 > I have recently started using Ant and came up with a few ideas while
 > migrating my build process to it. My directory structure is as follows:
 > 
 > Source tree:
 > /projects/src/servlet/client/Main.java
 > 
 > Classes tree:
 > /projects/classes/com/ibm/workflow/servlet/client/Main.class
 > 
 > That is, to avoid too much typing I put Main.java (and all the other files)
 > which is in the 'com.ibm.workflow.servlet.client' package in the
 > 'servlet/client' subtree of my source tree.
 > 
 > Now when I compile my sources using the following task
 > 
 >     <javac srcdir="/projects/src"
 >            destdir="/project/classes"
 >            includes="servlet/client/*.java"/>
 > 
 > It always recompiles all sources. This is because javac compares the
 > directories, but is missing the 'com/ibm/workflow' part of the directory.
 > 
 > A workaround is to first copy the sources to a fully named directory and
 > then compile from there:
 > 
 >     <copydir src="/projects/src"
 >              dest="/projects/ant/com/ibm/workflow"
 >              includes="servlet/client/*.java"/>
 >     <javac srcdir="/projects/ant"
 >            destdir="/projects/classes"
 >             includes="**/servlet/client/*.java"/>
 > 
 > But I don't like this approach so I thought one might simply add an
 > optional 'pkgdir' parameter to javac which would be used when comparing
 > srcdir and destdir. The task would then read like this:
 > 
 >     <javac_pkg srcdir="/projects/src"
 >            destdir="/projects/classes"
 >            pkgdir="com/ibm/workflow"
 >            includes="servlet/client/*.java"/>
 > 
 > I have already implemented this, it is just a few lines:
 > 
 >     private String pkgDirName;
 > :
 >     public void setPkgdir(String pkgDirName) {
 >         this.pkgDirName = pkgDirName;
 >     }
 > :
 >         File pkgDir = pkgDirName == null ? destDir : new File(destDir,
 > pkgDirName);
 >         scanDir(srcDir, pkgDir, files);
 > 
 >         // compile the source files
 > :
 > 
 > What do you think?
 > 
 > -Erich
 > 
 > 

Mime
View raw message