From bb22e5738126566b9e3ca826dfa2042e37ba59bd Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 16 Oct 2018 16:11:56 -0700 Subject: Fix logic which populates JAVAINCLUDES when javac is not found. Restore checks in some java tests to skip test if no javac and/or jar found --- src/engine/SCons/Tool/JavaCommon.py | 5 ++++- test/Java/JAR.py | 4 ++++ test/Java/JARCHDIR.py | 3 +++ test/Java/JARFLAGS.py | 4 ++++ test/Java/source-files.py | 4 ++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py index 3a472a9..ba74386 100644 --- a/src/engine/SCons/Tool/JavaCommon.py +++ b/src/engine/SCons/Tool/JavaCommon.py @@ -437,7 +437,10 @@ def get_java_include_paths(env, javac, version): :return: """ paths = [] - if env['PLATFORM'] == 'win32': + if not javac: + # there are no paths if we've not detected javac. + pass + elif env['PLATFORM'] == 'win32': javac_bin_dir = os.path.dirname(javac) java_inc_dir = os.path.normpath(os.path.join(javac_bin_dir, '..', 'include')) paths = [java_inc_dir, os.path.join(java_inc_dir, 'win32')] diff --git a/test/Java/JAR.py b/test/Java/JAR.py index 1eae9eb..d5425af 100644 --- a/test/Java/JAR.py +++ b/test/Java/JAR.py @@ -32,6 +32,10 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() +# Keep this logic because it skips the test if javac or jar not found. +where_javac, java_version = test.java_where_javac() +where_jar = test.java_where_jar() + test.write('myjar.py', r""" import sys args = sys.argv[1:] diff --git a/test/Java/JARCHDIR.py b/test/Java/JARCHDIR.py index e602fad..59bf082 100644 --- a/test/Java/JARCHDIR.py +++ b/test/Java/JARCHDIR.py @@ -38,6 +38,9 @@ import os import TestSCons test = TestSCons.TestSCons() +# Keep this logic because it skips the test if javac or jar not found. +where_javac, java_version = test.java_where_javac() +where_jar = test.java_where_jar() test.write('SConstruct', """ DefaultEnvironment(tools=[]) diff --git a/test/Java/JARFLAGS.py b/test/Java/JARFLAGS.py index e89d02b..39a0a6c 100644 --- a/test/Java/JARFLAGS.py +++ b/test/Java/JARFLAGS.py @@ -30,6 +30,10 @@ import TestSCons test = TestSCons.TestSCons() +# Keep this logic because it skips the test if javac or jar not found. +where_javac, java_version = test.java_where_javac() +where_jar = test.java_where_jar() + test.subdir('src') test.write('SConstruct', """ diff --git a/test/Java/source-files.py b/test/Java/source-files.py index ab395a0..e5cb8b6 100644 --- a/test/Java/source-files.py +++ b/test/Java/source-files.py @@ -35,6 +35,10 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() +# Keep this logic because it skips the test if javac or jar not found. +where_javac, java_version = test.java_where_javac() +where_jar = test.java_where_jar() + test.write('SConstruct', """ env = Environment(tools = ['javac', 'javah']) env.Java(target = 'class1', source = 'com/Example1.java') -- cgit v0.12 From 2888f3ae53a54b57a0b21dd46020a63b48cb505d Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 16 Oct 2018 16:13:34 -0700 Subject: Update CHANGES.txt --- src/CHANGES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index d5b9251..0f13ef5 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -51,6 +51,7 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - Fix Java tools to search reasonable default paths for Win32, Linux, macOS. Add required paths for swig and java native interface to JAVAINCLUDES. You should add these to your CPPPATH if you need to compile with them. This handles spaces in paths in default Java paths on windows. + - Fix new logic which populates JAVAINCLUDES to handle the case where javac is not found. From Andrew Featherstone - Removed unused --warn options from the man page and source code. -- cgit v0.12