ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magesh Umasankar" <>
Subject Smarter Javac
Date Sat, 17 Nov 2001 08:18:39 GMT

I noticed that this has been discussed for a short while
a long time back, but nothing solidified though.  So,
here goes:

Javac, as we are all aware, determines the file set that
is to be compiled based solely on comparing the
timestamps of the source and destinaiton files.  However,
this has got its limitations in numerous ways - one is
dependency checking, which has been solved by the
Depend task.  But still the glaring problem is this:
Say I compile a bunch of files using debug mode and
in my next iteration, I build it in non-debug mode, 
without having changed any of my source files. Javac is 
not going to catch this and would ignore processing any 
files (Yes, I am coming from the CONS world ;-) )  This
problem is going to exist when I switch compilers, or
when I enable/diable warnings, etc.

CONS has a nice way of solving this - it caches the 
command line being used and checks against the cached one
during future compiles to see if the current command line
matches the earlier one.

In the context of Ant, here is what I propose:

A cache file would be maintained that holds key-value
pairs.  A key-value pair is the task name and the MD5
checksum of the Javac command line.  When a Javac task 
named foo is invoked, the MD5 checksum of its command 
line is computed and checked against the cache, if 
available, by looking up the key foo.  If the cache isn't
there, one is created.  If the checksums differ, all 
source files would be compiled again and the new 
checksum would be cached - otherwise, Javac would do 
what it does now.

While this may slow the Javac process launch just a 
wee little bit, it would be of great use to the user.

What do you think?  The crude proof-of-concept that I 
built didn't change a lot of code at all...


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message