In practice, I've found the <depend> task in Ant to be very reliable, and
compensates for defficiencies in using Javac's (or Jike's) dependency
analysis within Ant.  In particular, if an interface changes in a way that
breaks a dependent class, but that dependent class is not itself out of
date, the error is undetectable by the compiler, but can be discovered by
the <depend> task.  

The cases where the <depend> task does not accurately compute dependencies
are these (from the Ant docs):

1.  If the Java compiler optimizes away a class relationship, there can be a
source dependency without a class dependency.  <-- The class dependency is
more relevant anyway, so in general this is not a problem.

2.  Non public classes cause two problems. Firstly depend cannot relate the
class file to a source file. In the future this may be addressed using the
source file attribute in the classfile. Secondly, neither depend nor the
compiler tasks can detect when a non public class is missing. Inner classes
are handled by the depend task.  <-- As long as inner classes are handled,
I'm happy.  The failure to detect non-public classes is a problem, but in my
experience not a critical one (our project has no non-public classes).

Cheers,
David



-----Original Message-----
From: Paul Kinnucan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 21, 2001 8:32 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: PROPOSAL: New Java Build Feature (LONG) 


At 07:29 PM 3/21/2001 -0800, you wrote:
>
>I stand corrected - the depend task works exactly as Mark says it does.
>
>Mark, thanks for bringing this to my attention.
>

Nevertheless, the Ant depend task admittedly does not detect all
dependencies. I therefore question its value. I would not want to rely on a
build program that could result in an invalid build or have to continually
evaluate changes that I make to the source to determine their impact on the
validity of the build program.

I guess you could say that the Ant depend task, though not perfect, does a
better job of dependency analysis than javac and thus could be used like
javac, i.e, compile and if the app works, fine. If not, recompile
everything to make sure that the problem is not due to dependency analysis
failures. I find that javac dependency analysis is good enough for most
compiles and I only occasionally have to rebuild the entire application. So
I'm not sure there would be much motivation for me to go to the trouble of
setting up an Ant build based on the Ant depend task.

- Paul

Reply via email to