Adjust java detection so it's more likely to work on jdks that write -version to stderr.

This commit is contained in:
Dan 2019-07-27 18:30:25 -04:00
parent 9b776e214a
commit 7d5a8fa6a4
2 changed files with 3 additions and 2 deletions

View File

@ -10,7 +10,7 @@ PYTHON=python
NOSETESTS=nosetests
endif
JAVA_TARGET ?= $(shell javac -version | $(PYTHON) -c "import re; print('1.6' if int(re.findall(r'\d+', input())[0]) < 12 else '1.7')" )
JAVA_TARGET ?= $(shell $(PYTHON) -c "import re; print('1.6' if int(re.findall(r'\d+', '$(shell javac -version 2>&1)')[0]) < 12 else '1.7')" )
JAVAC_OPTS=-target $(JAVA_TARGET) -source $(JAVA_TARGET)
JAVAC=javac $(JAVAC_OPTS)

View File

@ -95,7 +95,8 @@ def compile_native_invocation_handler(*possible_homes):
source_level = '1.6'
# We have to check what version of javac this is, because -target 1.6 is
# no longer supported on JDKs >= 12.
javac_version = subprocess.check_output([javac, '-version'])
javac_version = subprocess.check_output([javac, '-version'],
stderr=subprocess.STDOUT)
for m in re.finditer(r'\d+', javac_version.decode('ascii')):
if int(m.group(0)) >= 12:
source_level = '1.7'