ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject RE: Dependencies
Date Tue, 12 Dec 2000 23:16:41 GMT

> Two questions:
>      1) Does ANT and/or jdk1.3-based JAVAC perform automatic "forward"
> dependency-checking?  That is, ClassA depends on
>           ClassB depends on ClassC, and a change is made to
>, will
> ANT or JAVAC figure that out and include it upon
>           recompiling  I think JAVAC does this
> automagically under
> jdk1.3, replacing the need for the unofficial
>           -Xdepend option of jdk1.2.2, but I would like someone
> to confirm that
> this is correct.

I think, in general, you want this to work the other way around. When you
change you want ClassB and hence classA recompiled. When javac
compiles ClassA, it will not, and should not, compile ClassB and ClassC,
since the dependencies work the other way around. They should only be
recompiled if they have been changed.

In any case, I do not think javac handles such dependencies. I'd be happy to
be wrong on that. I have heard that the Jikes compiler does handle such
dependencies but I haven't checked that out. This is really what the
<depend> task is for. It adds the dependency handling in a way which does
not impact the javac task. If you change classC, the depend task will remove
classB.class and, optionally, classA.class

>      2) Conor: LOVE the stuff you're doing with "reverse"
> dependency-checking.
> I haven't even downloaded your code yet --- and I
>           will --- but before I start picking through it, I
> thought I'd ask
> whether it can be easily tweaked to spit out  logfile of all dependencies
>           it has found.  That is, when I compile
> com.mycompany.mypackage, could
> I generate a list of all classes that depends on
>           somewhere?  Like I said, I'll look at your code myself,
> but I thought
> you might be able to tell me off the top of your head.

The depend task works out dependencies in one direction (classX depends on
ClassY, ClassZ) and then reverses that to arrive at an "affects" list
(classZ affects classX, classT). There is some code, which is commented out
currently, which prints out the dependencies. You can uncomment that to see
the dependencies. Be warned that the output for even moderate collections of
classes can be quite large.


View raw message