ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@cortexebusiness.com.au>
Subject RE: auto dependency generation?
Date Thu, 11 Apr 2002 03:59:50 GMT
> From: kenyee@keysolutions.com [mailto:kenyee@keysolutions.com]
>
> On 04/10/2002 03:10:30 PM, Diane Holt wrote:
> > There's the <depend> task, but it works once the class files are all
> > compiled (since it uses them to determine the dependencies).
>
> Found that as well...seemed like a backwards thing do
> do (needing class files to generate dependencies :-)
>

<depend> really answers the question "What do I need to *recompile* due to a
change in my source?" It does that by looking at the class file to see which
other classes a class uses. If any of those classes have changes, the class
in question needs to be recompiled to make sure it is in sync with the new
code. <depend> uses class files because it is generally much faster if you
do not need to parse the source. If you are going to parse the source then
it probably is just as good to recompile everything.

In your case, you are interested in dependencies in the opposite direction -
which classes do I need to exist in order to compile my class? Normally the
Javac compiler will handle this issue. If a class, which is required, does
not yet exist, javac will attempt to find a source file by looking at the
source path.

>
> > But won't the Java compiler go compile whatever it needs whenever it
> > needs it? Does the Interface source file live in some subdir down from
> > the dir specified in 'srcdir'?
>
> Both (the Interface source file and the Class that uses that
> Interface) java files live in com/blah/blah which is under the srcdir.

In this case, javac will automatically compile the interface as required. If
this is not happening, I suspect a problem in your build file. I suggest you
run ant with the -debug flag and see what files <javac> is considering. If
you still have problems, send us a snippet of your build file and the debug
output (zipped).

Conor


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message