[Scons-users] SCONS BUG REPORT: Javac emitter fails to locate compiled classes from derived .java files

Matthew Marinets Matthew.Marinets at Kardium.com
Tue Feb 27 13:09:12 EST 2018


I just posted this issue to Stack Overflow as well, URL:
https://stackoverflow.com/questions/49015147/scons-compiling-generated-java-files-doesnt-check-if-they-are-part-of-a-packa

Using SCons 3.0.0 on Windows 10 with Python 2.7

I explain the bug in the comment in the SConstruct file.

What is fundamentally happening is that line 96 of Tools/javac.py blocks any kind of parsing of .java files if the .java file is considered "derived." This means that any generated or copied .java file will not be parsed properly in the javac emitter and the resulting target node will not match where the .class file is actually placed.

I demonstrated this by taking a simple .java file, running it through env.Command to copy it, and passing the resulting file into the env.Java builder. The .class file builds fine, but the target node points in the wrong location, and thus SCons will think that the file is missing / out of date and will run again. Changing the 'if not f.is_derived():' to 'if True:' on line 96 of Javac.py fixes this issue, but I'm not sure why this if statement is there in the first place or if this breaks anything else.

-Matthew

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180227/f6c38aeb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SConsBug.7z
Type: application/octet-stream
Size: 6900 bytes
Desc: SConsBug.7z
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180227/f6c38aeb/attachment.obj>


More information about the Scons-users mailing list