Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 29528 invoked from network); 3 Jul 2000 23:31:41 -0000 Received: from leopard.ardec.com.au (root@203.11.83.9) by locus.apache.org with SMTP; 3 Jul 2000 23:31:41 -0000 Received: from cougar.adl.ardec.com.au (cougar.adl.ardec.com.au [192.168.83.8]) by leopard.ardec.com.au (8.10.1/8.10.1/NC19991210) with ESMTP id e63NVdJ03021 for ; Tue, 4 Jul 2000 09:01:39 +0930 (CST) Received: from lisa.com.au (pugwash.adl.ardec.com.au [192.168.83.60]) by cougar.adl.ardec.com.au (8.9.3/8.9.3/NC20000131) with ESMTP id JAA02286 for ; Tue, 4 Jul 2000 09:01:39 +0930 (CST) Received: (from tcook@localhost) by lisa.com.au (8.9.3/8.9.3) id JAA02112; Tue, 4 Jul 2000 09:01:38 +0930 From: Tom Cook MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14689.8794.939448.346549@pugwash.adl.ardec.com.au> Date: Tue, 4 Jul 2000 09:01:38 +0930 (CST) To: ant-dev@jakarta.apache.org Subject: WIBNI for Javac Task In-Reply-To: References: X-Mailer: VM 6.72 under 21.1 (patch 8) "Bryce Canyon" XEmacs Lucid X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N 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 > > 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: > > dest="/projects/ant/com/ibm/workflow" > includes="servlet/client/*.java"/> > 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: > > 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 > >