[Scons-users] java builder not working with variant directory

Dirk Bächle tshortik at gmx.de
Wed Jun 25 18:40:36 EDT 2014


Bill,

On 25.06.2014 21:36, William Roberts wrote:
> I *think* i've tried that before with the same results.
>
> I applied the changes you suggested, and still hit the same error, can
> you send me your modifications or a diff?

please find my version attached. The main difference is that I use 
"duplicate=0" instead of "duplicate=1" in the top-level SConstruct 
(sorry, I forgot to tell). After looking at the sources of javac.py and 
Node.FS.py some more, I'm quite sure that this is the only way to make 
things work.
Patching the Java tool or the core sources won't help, due to the 
underlying problem: In the Emitter, an os.walk() is used to collect 
together the single *.java files in all the subdirectories. But in the 
"build" folder (the variant dir), the copies of the source files haven't 
been created so far. So there is no folder tree structure to traverse 
for the os.walk(), and no *.java files can be tried to get resolved by 
copying/linking them from the corresponding source directory.

This is different for C/CPP builds, because there a Glob() (or naming 
single files) is used in the source folder directly, when specifying the 
input files. So, if you use a

   cls = Java(target = 'classes', source = Glob('main/*.java'))

in your SConscript, the "duplicate=1" should work again. But since the 
Glob() method doesn't work recursively (yet, I'm working on it), you'd 
have to repeatedly call it for each of your Java subfolders. :(

I hope this explanation makes things a little clearer for you...

Regards,

Dirk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixed.tar
Type: application/x-tar
Size: 10240 bytes
Desc: not available
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140626/83961e02/attachment-0001.tar>


More information about the Scons-users mailing list