Discussion:
[Scons-users] SCONS BUG REPORT: Javac emitter fails to locate compiled classes from derived .java files
Matthew Marinets
2018-02-27 18:09:12 UTC
Permalink
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

Loading...