Add experimental flag to support OpenJDK builds.
bug: 8992787 Change-Id: Ice0fc7dea1d855914fdab9a01b1ac9c722031288
This commit is contained in:
committed by
Narayan Kamath
parent
aac6ef5905
commit
d1dbe7f5a2
@@ -6,13 +6,21 @@
|
|||||||
#
|
#
|
||||||
# Outputs:
|
# Outputs:
|
||||||
# COMMON_JAVAC -- Java compiler command with common arguments
|
# COMMON_JAVAC -- Java compiler command with common arguments
|
||||||
|
#
|
||||||
|
|
||||||
|
ifeq ($(EXPERIMENTAL_USE_JAVA7_OPENJDK),)
|
||||||
|
common_flags := -target 1.5 -Xmaxerrs 9999999
|
||||||
|
else
|
||||||
|
common_flags := -Xmaxerrs 9999999
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
# Whatever compiler is on this system.
|
# Whatever compiler is on this system.
|
||||||
ifeq ($(BUILD_OS), windows)
|
ifeq ($(BUILD_OS), windows)
|
||||||
COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
|
COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
|
||||||
-target 1.5 -Xmaxerrs 9999999
|
$(common_flags)
|
||||||
else
|
else
|
||||||
COMMON_JAVAC := javac -J-Xmx512M -target 1.5 -Xmaxerrs 9999999
|
COMMON_JAVAC := javac -J-Xmx512M $(common_flags)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Eclipse.
|
# Eclipse.
|
||||||
@@ -22,14 +30,6 @@ ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
|
|||||||
$(info CUSTOM_JAVA_COMPILER=eclipse)
|
$(info CUSTOM_JAVA_COMPILER=eclipse)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# OpenJDK.
|
|
||||||
ifeq ($(CUSTOM_JAVA_COMPILER), openjdk)
|
|
||||||
# We set the VM options (like -Xmx) in the javac script.
|
|
||||||
COMMON_JAVAC := prebuilt/common/openjdk/bin/javac -target 1.5 \
|
|
||||||
-Xmaxerrs 9999999
|
|
||||||
$(info CUSTOM_JAVA_COMPILER=openjdk)
|
|
||||||
endif
|
|
||||||
|
|
||||||
HOST_JAVAC ?= $(COMMON_JAVAC)
|
HOST_JAVAC ?= $(COMMON_JAVAC)
|
||||||
TARGET_JAVAC ?= $(COMMON_JAVAC)
|
TARGET_JAVAC ?= $(COMMON_JAVAC)
|
||||||
|
|
||||||
|
35
core/main.mk
35
core/main.mk
@@ -140,7 +140,18 @@ $(warning ************************************************************)
|
|||||||
$(error Directory names containing spaces not supported)
|
$(error Directory names containing spaces not supported)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Check for the corrent jdk
|
# Check for the current jdk
|
||||||
|
ifneq ($(EXPERIMENTAL_USE_JAVA7_OPENJDK),)
|
||||||
|
# The user asked for java7 openjdk, so check that the host
|
||||||
|
# java version is really openjdk
|
||||||
|
ifeq ($(shell java -version 2>&1 | grep -i openjdk),)
|
||||||
|
$(info ************************************************************)
|
||||||
|
$(info You asked for an OpenJDK 7 build but your version is)
|
||||||
|
$(info $(shell java -version 2>&1 | head -n 2).)
|
||||||
|
$(info ************************************************************)
|
||||||
|
$(error stop)
|
||||||
|
endif # java version is not OpenJdk
|
||||||
|
else # if EXPERIMENTAL_USE_JAVA7_OPENJDK
|
||||||
ifneq ($(shell java -version 2>&1 | grep -i openjdk),)
|
ifneq ($(shell java -version 2>&1 | grep -i openjdk),)
|
||||||
$(info ************************************************************)
|
$(info ************************************************************)
|
||||||
$(info You are attempting to build with an unsupported JDK.)
|
$(info You are attempting to build with an unsupported JDK.)
|
||||||
@@ -150,17 +161,30 @@ $(info Please follow the machine setup instructions at)
|
|||||||
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
|
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
|
||||||
$(info ************************************************************)
|
$(info ************************************************************)
|
||||||
$(error stop)
|
$(error stop)
|
||||||
endif
|
endif # java version is not Sun Oracle JDK
|
||||||
|
endif # if EXPERIMENTAL_USE_JAVA7_OPENJDK
|
||||||
|
|
||||||
# Check for the correct version of java
|
# Check for the correct version of java, should be 1.7 if
|
||||||
|
# EXPERIMENTAL_USE_JAVA7_OPENJDK is set, 1.6 otherwise.
|
||||||
|
ifneq ($(EXPERIMENTAL_USE_JAVA7_OPENJDK),)
|
||||||
|
required_version := "OpenJDK 1.7"
|
||||||
|
required_javac_version := "1.7"
|
||||||
|
java_version := $(shell java -version 2>&1 | head -n 1 | grep '^java .*[ "]1\.7[\. "$$]')
|
||||||
|
javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.7[\. "$$]')
|
||||||
|
else # if EXPERIMENTAL_USE_JAVA7_OPENJDK
|
||||||
|
required_version := "JavaSE 1.6"
|
||||||
|
required_javac_version := "1.6"
|
||||||
java_version := $(shell java -version 2>&1 | head -n 1 | grep '^java .*[ "]1\.6[\. "$$]')
|
java_version := $(shell java -version 2>&1 | head -n 1 | grep '^java .*[ "]1\.6[\. "$$]')
|
||||||
|
javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
|
||||||
|
endif # if EXPERIMENTAL_USE_JAVA7_OPENJDK
|
||||||
|
|
||||||
ifeq ($(strip $(java_version)),)
|
ifeq ($(strip $(java_version)),)
|
||||||
$(info ************************************************************)
|
$(info ************************************************************)
|
||||||
$(info You are attempting to build with the incorrect version)
|
$(info You are attempting to build with the incorrect version)
|
||||||
$(info of java.)
|
$(info of java.)
|
||||||
$(info $(space))
|
$(info $(space))
|
||||||
$(info Your version is: $(shell java -version 2>&1 | head -n 1).)
|
$(info Your version is: $(shell java -version 2>&1 | head -n 1).)
|
||||||
$(info The correct version is: Java SE 1.6.)
|
$(info The required version is: $(required_version))
|
||||||
$(info $(space))
|
$(info $(space))
|
||||||
$(info Please follow the machine setup instructions at)
|
$(info Please follow the machine setup instructions at)
|
||||||
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
|
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
|
||||||
@@ -169,14 +193,13 @@ $(error stop)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Check for the correct version of javac
|
# Check for the correct version of javac
|
||||||
javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
|
|
||||||
ifeq ($(strip $(javac_version)),)
|
ifeq ($(strip $(javac_version)),)
|
||||||
$(info ************************************************************)
|
$(info ************************************************************)
|
||||||
$(info You are attempting to build with the incorrect version)
|
$(info You are attempting to build with the incorrect version)
|
||||||
$(info of javac.)
|
$(info of javac.)
|
||||||
$(info $(space))
|
$(info $(space))
|
||||||
$(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
|
$(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
|
||||||
$(info The correct version is: 1.6.)
|
$(info The required version is: $(required_javac_version))
|
||||||
$(info $(space))
|
$(info $(space))
|
||||||
$(info Please follow the machine setup instructions at)
|
$(info Please follow the machine setup instructions at)
|
||||||
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
|
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
|
||||||
|
Reference in New Issue
Block a user