Merge "Build with java7 by default."

This commit is contained in:
Ying Wang 2014-04-05 01:46:20 +00:00 committed by Gerrit Code Review
commit 260942fa82
4 changed files with 38 additions and 55 deletions

View file

@ -9,7 +9,7 @@
# COMMON_JAVAC -- Java compiler command with common arguments
#
ifeq ($(EXPERIMENTAL_USE_JAVA7),)
ifneq ($(LEGACY_USE_JAVA6),)
common_flags := -target 1.5 -Xmaxerrs 9999999
else
common_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999

View file

@ -359,7 +359,7 @@ endif
OLD_FLEX := prebuilts/misc/$(HOST_PREBUILT_TAG)/flex/flex-2.5.4a$(HOST_EXECUTABLE_SUFFIX)
ifeq ($(HOST_OS),darwin)
ifneq ($(EXPERIMENTAL_USE_JAVA7),)
ifeq ($(LEGACY_USE_JAVA6),)
HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
else
# Deliberately set to blank for Java 6 installations on MacOS. These

View file

@ -103,7 +103,7 @@ include $(BUILD_SYSTEM)/cleanbuild.mk
# Include the google-specific config
-include vendor/google/build/config.mk
VERSION_CHECK_SEQUENCE_NUMBER := 4
VERSION_CHECK_SEQUENCE_NUMBER := 5
-include $(OUT_DIR)/versions_checked.mk
ifneq ($(VERSION_CHECK_SEQUENCE_NUMBER),$(VERSIONS_CHECKED))
@ -140,19 +140,48 @@ $(warning ************************************************************)
$(error Directory names containing spaces not supported)
endif
java_version_str := $(shell unset _JAVA_OPTIONS && java -version 2>&1)
javac_version_str := $(shell unset _JAVA_OPTIONS && javac -version 2>&1)
# Check for the correct version of java, should be 1.7 by
# default, and 1.6 if LEGACY_USE_JAVA6 is set.
ifeq ($(LEGACY_USE_JAVA6),)
required_version := "1.7.x"
required_javac_version := "1.7"
java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.7[\. "$$]')
javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.7[\. "$$]')
else # if LEGACY_USE_JAVA6
required_version := "1.6.x"
required_javac_version := "1.6"
java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.6[\. "$$]')
javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.6[\. "$$]')
endif # if LEGACY_USE_JAVA6
ifeq ($(strip $(java_version)),)
$(info ************************************************************)
$(info You are attempting to build with the incorrect version)
$(info of java.)
$(info $(space))
$(info Your version is: $(java_version_str).)
$(info The required version is: $(required_version))
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/initializing.html)
$(info ************************************************************)
$(error stop)
endif
# Check for the current JDK.
#
# For Java 1.7, we require OpenJDK on linux and Oracle JDK on Mac OS.
# For Java 1.6, we require Oracle for all host OSes.
requires_openjdk := false
ifneq ($(EXPERIMENTAL_USE_JAVA7),)
ifeq ($(LEGACY_USE_JAVA6),)
ifeq ($(HOST_OS), linux)
requires_openjdk := true
endif
endif
java_version_str := $(shell unset _JAVA_OPTIONS && java -version 2>&1)
javac_version_str := $(shell unset _JAVA_OPTIONS && javac -version 2>&1)
# Check for the current jdk
ifeq ($(requires_openjdk), true)
@ -182,53 +211,6 @@ $(error stop)
endif # java version is not Sun Oracle JDK
endif # if requires_openjdk
# Check for the correct version of java, should be 1.7 if
# EXPERIMENTAL_USE_JAVA7 is set, 1.6 otherwise.
ifneq ($(EXPERIMENTAL_USE_JAVA7),)
required_version := "1.7.x"
required_javac_version := "1.7"
java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.7[\. "$$]')
javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.7[\. "$$]')
else # if EXPERIMENTAL_USE_JAVA7
required_version := "1.6.x"
required_javac_version := "1.6"
java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.6[\. "$$]')
javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.6[\. "$$]')
endif # if EXPERIMENTAL_USE_JAVA7
ifeq ($(required_javac_version), "1.6")
$(info ************************************************************)
$(info You are attempting to build with java 1.6.)
$(info Java6 support for master builds will be dropped shortly,)
$(info please upgrade to Java7 as soon as possible.)
$(info $(space))
$(info Visit http://source.android.com/source/initializing.html#installing-the-jdk for details. )
$(info $(space))
$(info To build using java-7:)
$(info $(space))
$(info $$ export EXPERIMENTAL_USE_JAVA7=true)
$(info $$ . build/envsetup.sh)
$(info $$ lunch <target>)
$(info $$ make clobber)
$(info $$ make -j8)
$(info $(space))
$(info ************************************************************)
endif
ifeq ($(strip $(java_version)),)
$(info ************************************************************)
$(info You are attempting to build with the incorrect version)
$(info of java.)
$(info $(space))
$(info Your version is: $(java_version_str).)
$(info The required version is: $(required_version))
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
$(info ************************************************************)
$(error stop)
endif
# Check for the correct version of javac
ifeq ($(strip $(javac_version)),)
$(info ************************************************************)

View file

@ -1380,7 +1380,8 @@ function godir () {
# JavaVM.framework/Versions/1.7/ folder.
function set_java_home() {
# Clear the existing JAVA_HOME value if we set it ourselves, so that
# we can reset it later, depending on the value of EXPERIMENTAL_USE_JAVA7.
# we can reset it later, depending on the version of java the build
# system needs.
#
# If we don't do this, the JAVA_HOME value set by the first call to
# build/envsetup.sh will persist forever.
@ -1389,7 +1390,7 @@ function set_java_home() {
fi
if [ ! "$JAVA_HOME" ]; then
if [ ! "$EXPERIMENTAL_USE_JAVA7" ]; then
if [ -n "$LEGACY_USE_JAVA6" ]; then
case `uname -s` in
Darwin)
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home