ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott M Stark" <Scott_St...@displayscape.com>
Subject Re: how to supplement javac compile dependencies?
Date Fri, 20 Oct 2000 19:26:50 GMT
If you build into a tree separate from the source tree and remove the build tree
at the start of a full build you are guarenteed to avoid this dependency problem.

If you don't want to take the compilation hit then you do have to create a custom
task, but you should only have to subclass the include task and use that with the
existing javac. Say you create such a smartinclude task I would expect you
could use it as:

<javac destdir = "${build.dir}" debug="true" classpathref = "project.class.path">
    <smartinclude name = "com/dscape/core/logging/*" />
    <exclude name = "com/dscape/logging/Log4jPkgCategory.java" />
    <src path = "/usr/local/dscape/src/classes"/>
</javac>

I would think that this would be easier than deleting the class files which you want
to be updated.

> My question is, how can I supplement the dependency checking that the
> 'javac' task does?  It obviously compares the timestamp between the java
> file and the compiled class file and recompiles if the java file is
> newer.  But, this is not enough in some cases.
> 
> For example, in a package with lots of java files that have already been
> compiled, if I change one file in an incompatible way then recompile
> using ant, then it only compiles the file that changed, but then the
> other compiled classes will be unchanged but will not work since I broke
> something that should have been caught at compile time.  It would be
> wonderful if ant could figure this out and recompile all effected
> classes.  But short of that, is there a mechanism where I can say that
> these java files depend upon this other one (like in makefiles), thereby
> forcing ant to recompile the other files?
> 
> Is the only way to do this to write my own task that checks these
> dependencies and deletes the generated class files before calling
> 'javac' thereby making it recompile?
> 
> Thanks for any help!
> 
> Bob
> 


Mime
View raw message