[Scons-users] Questions about building Java code

Dirk Bächle tshortik at gmx.de
Fri Apr 26 14:48:25 EDT 2013


Hi Dirk,

On 26.04.2013 12:08, Dirk Heinrichs wrote:

> Hi,

>

> I'm doing a little evaluation of Scons as a possible replacement for

> Ant. I've setup a small test build containing two .java files and did a

> typical build, edit, build cycle. This is what I got:

>

> % scons -Q

> /usr/bin/javac -d classes -sourcepath src src/ExtraClass.java src/MainClass.java

> % vim src/MainClass.java

> % scons -Q

> Retrieved `classes/ExtraClass.class' from cache

> /usr/bin/javac -d classes -sourcepath src src/ExtraClass.java src/MainClass.java

>

> Two things look strange here:

>

> 1) Why is classes/ExtraClass.class retrieved from the cache although its

> source file didn't change?

> 2) Why is anything retrieved from the cache at all when javac

> recompiles all the files afterwards?


I'm no Java expert but here's what I see: You are obviously using
CacheDir to share created files. This is why an up-to-date version of
'classes/ExtraClass.class' can be retrieved from the CacheDir, instead
of recompiling ExtraClass.java. So that's what SCons is doing in 1).

ad 2): You changed "MainClass.java", so SCons has to recompile it...also
using ExtraClass.class, since it might contain definitions MainClass
depends on.

So it all makes sense to me.

Best regards,

Dirk




More information about the Scons-users mailing list