You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Nathan Murphy <na...@zucotto.com> on 2000/12/01 21:00:10 UTC

Dependancies in the javac task

Scanning through the source code of the Javac ant task, I see the scanDir
function that makes use of timestamp dependancies.  What I don't seem to
find is compilation do to interfile dependancies.

i.e.

	Class a creates an instance of class b.
	The developer changes the constructor for b.
	The user makes their load but does not remove all the old class
files:
		Javac ant task checks timestamp dependancies and seeing
b.java newer then b.class, recompiles b.class.
		However, the timestamp of a.java and a.class are unchanged
so a.class is not recompiled.
		No compilation time errors are produced.
	The user now runs the main function of their java class and gets a
runtime error.

It is more desirable to have the error occur in compilation time, or rather
have the dependancies be on interfile, not just timestamp.  Is there plans
for such development?  If not, is there any ideas or suggestions on how to
expand the Javac ant task?


-- 
Zucotto Wireless Inc.
Nathan Murphy, B.Eng Electrical
Software Developer - LoadBuild Prime
nmurphy@zucotto.com
Phone:(613) 789-0090 ext. 426
Fax:  (613) 789-0050
http://www.zucotto.com

RE: Dependancies in the javac task

Posted by Conor MacNeill <co...@m64.com>.
Nathan,

> -----Original Message-----
> From: Nathan Murphy [mailto:nathan.murphy@zucotto.com]
> Sent: Saturday, 2 December 2000 7:00
> To: ant-user@jakarta.apache.org
> Subject: Dependancies in the javac task
>
>
> Scanning through the source code of the Javac ant task, I see
> the scanDir
> function that makes use of timestamp dependancies.  What I
> don't seem to
> find is compilation do to interfile dependancies.
>
> i.e.
>
> 	Class a creates an instance of class b.
> 	The developer changes the constructor for b.
> 	The user makes their load but does not remove all the old class
> files:
> 		Javac ant task checks timestamp dependancies and seeing
> b.java newer then b.class, recompiles b.class.
> 		However, the timestamp of a.java and a.class
> are unchanged
> so a.class is not recompiled.
> 		No compilation time errors are produced.
> 	The user now runs the main function of their java class
> and gets a
> runtime error.
>

This is a common enough question. One solution is to use a compiler that
does a better job of dependency management that javac, such as Jikes.
Another is to use the <depend> task. This is not part of ant 1.2 but is
available in the nightly builds.

The link http://marc.theaimsgroup.com/?l=ant-dev&m=97271084914574&w=2
gives you some info on the task.

Conor