[Scons-users] Questions about building Java code

Dirk Heinrichs dirk.heinrichs at altum.de
Sat Apr 27 02:51:55 EDT 2013


On 26.04.2013 20:48, Dirk Bächle wrote:

> 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).


But it doesn't need to. It's up to date and still present from the first
build. There's no need to get it from the cache at all.


> ad 2): You changed "MainClass.java", so SCons has to recompile

> it...also using ExtraClass.class, since it might contain definitions

> MainClass depends on.


That's how javac works. It has to recompile something, so it recompiles
_everything_.


> So it all makes sense to me.


A useless cache retrieval of an up-to-date file that is then recompiled
anyway doesn't make sense to me. But I guess it's the best it can do
considering how javac works ;)

Bye...

Dirk

--
Dirk Heinrichs <dirk.heinrichs at altum.de>
Tel: +49 (0)2471 209385 | Mobil: +49 (0)176 34473913
GPG Public Key C2E467BB | Jabber: dirk.heinrichs at altum.de


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130427/3567225c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : <http://four.pairlist.net/pipermail/scons-users/attachments/20130427/3567225c/attachment.pgp>


More information about the Scons-users mailing list