You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Alan Santos <as...@exceloncorp.com> on 2000/02/09 01:08:53 UTC

monolothic build requirements

Hi I was hoping someone would be able to point out a mistake or
misunderstanding on my part.

I am attempting to use ant to build a relatively large system.  However I
would like to be able to build pieces of it, without building unrelated
pieces.

My directory structure is this:

src/
  /java
   /com
    /theCompany
     /aPackage
     /anotherPackage

I would like to be able to build aPackage without building anotherPackage,
assuming there are no dependencies between the two.

So I've specified three targets in my build file.

<target name="aPackage"
   <javac srcdir="com/theCompany/aPackage" ...

 <target name="anotherPackage"
   <javac srcdir="com/theCompany/anotherPackage

 <target name="all" depends="aPackage, anotherPackage"...

Doing this results in a complete rebuild every time through, because the
correct class files are not found to compare timestamps with.

providing a target like
 <target name="monolithic"
  <javac srcdir="." ...

works correctly.

Looking through the code the root of the matter appears to be that there is
a dependency/assumption that the srcDir is above the class' package dir
within
Taskdef/Javac and DirectoryScanner and that the source file name (I think)
contains the package.

If I remember correctly, my class files are in
build/com/theCompany/aPackage/xx.class

while javac.java compares the source file against build/xxx.class
(Specifically in the call to Javac.scanDir with the results from
DirectoryScanner)

I don't actually see *how* after looking at the code that modularized builds
are possible with ant, unless another tag is created specifying base source
dir which javac can pre-pend to the file name, or something along those
lines.

Any thoughts?

I certainly don't mind implementing the functionality, however there may be
a better way or reason for not doing this in the first  place.

thanks,
alan