Loading core/combo/javac.mk +12 −8 Original line number Diff line number Diff line Loading @@ -16,20 +16,16 @@ endif common_jdk_flags := -Xmaxerrs 9999999 ANDROID_JAVA_HOME := prebuilts/jdk/jdk8/$(HOST_PREBUILT_TAG) ANDROID_JAVA_TOOLCHAIN := $(ANDROID_JAVA_HOME)/bin export JAVA_HOME := $(ANDROID_JAVA_HOME) # Use the indexer wrapper to index the codebase instead of the javac compiler ifeq ($(ALTERNATE_JAVAC),) JAVACC := $(ANDROID_JAVA_TOOLCHAIN)/javac JAVACC := javac else JAVACC := $(ALTERNATE_JAVAC) endif JAVA := $(ANDROID_JAVA_TOOLCHAIN)/java JAVADOC := $(ANDROID_JAVA_TOOLCHAIN)/javadoc JAR := $(ANDROID_JAVA_TOOLCHAIN)/jar JAVA := java JAVADOC := javadoc JAR := jar # The actual compiler can be wrapped by setting the JAVAC_WRAPPER var. ifdef JAVAC_WRAPPER Loading @@ -38,8 +34,16 @@ ifdef JAVAC_WRAPPER endif endif # Whatever compiler is on this system. COMMON_JAVAC := $(JAVACC) -J-Xmx2048M $(common_jdk_flags) # Eclipse. ifeq ($(CUSTOM_JAVA_COMPILER), eclipse) COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \ -maxProblems 9999999 -nowarn $(info CUSTOM_JAVA_COMPILER=eclipse) endif GLOBAL_JAVAC_DEBUG_FLAGS := -g HOST_JAVAC ?= $(COMMON_JAVAC) Loading core/config.mk +11 −12 Original line number Diff line number Diff line Loading @@ -676,13 +676,22 @@ ANDROID_MANIFEST_MERGER := $(JAVA) -classpath prebuilts/devtools/tools/lib/manif COLUMN:= column # We may not have the right JAVA_HOME/PATH set up yet when this is run from envsetup.sh. ifneq ($(CALLED_FROM_SETUP),true) # Path to tools.jar, or empty if EXPERIMENTAL_USE_OPENJDK9 is set HOST_JDK_TOOLS_JAR := # TODO: Remove HOST_JDK_TOOLS_JAR and all references to it once OpenJDK 8 # toolchains are no longer supported (i.e. when what is now # EXPERIMENTAL_USE_OPENJDK9 becomes the standard). http://b/38418220 ifeq ($(EXPERIMENTAL_USE_OPENJDK9),) HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA_TOOLCHAIN)/../lib/tools.jar HOST_JDK_TOOLS_JAR := $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh) ifneq ($(HOST_JDK_TOOLS_JAR),) ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),) $(error Error: could not find jdk tools.jar at $(HOST_JDK_TOOLS_JAR), please check if your JDK was installed correctly) endif endif endif # ifeq ($(EXPERIMENTAL_USE_OPENJDK9),) # Is the host JDK 64-bit version? Loading @@ -690,6 +699,7 @@ HOST_JDK_IS_64BIT_VERSION := ifneq ($(filter 64-Bit, $(shell $(JAVA) -version 2>&1)),) HOST_JDK_IS_64BIT_VERSION := true endif endif # CALLED_FROM_SETUP not true # It's called md5 on Mac OS and md5sum on Linux ifeq ($(HOST_OS),darwin) Loading Loading @@ -844,17 +854,6 @@ unexport ANDROID_JAVA_HOME unexport JAVA_HOME export ANDROID_BUILD_PATHS:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(ANDROID_BUILD_PATHS) export PATH:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(PATH) else # Put java first on the path # TODO(ccross): remove this once tools run during the build no longer depend on # finding java in the path ifeq (,$(strip $(CALLED_FROM_SETUP))) ifneq ($(shell which java),$(abspath $(ANDROID_JAVA_TOOLCHAIN)/java)) $(warning Found incorrect java $(shell which java) in $$PATH) $(warning Adding $(abspath $(ANDROID_JAVA_TOOLCHAIN)) to $$PATH) export PATH:=$(abspath $(ANDROID_JAVA_TOOLCHAIN)):$(PATH) endif endif endif # Projects clean of compiler warnings should be compiled with -Werror. Loading core/find-jdk-tools-jar.sh 0 → 100755 +20 −0 Original line number Diff line number Diff line #!/bin/sh if [ "x$ANDROID_JAVA_HOME" != x ] && [ -e "$ANDROID_JAVA_HOME/lib/tools.jar" ] ; then echo $ANDROID_JAVA_HOME/lib/tools.jar else JAVAC=$(realpath $(which javac) 2>/dev/null) if [ -z "$JAVAC" ]; then JAVAC=$(readlink -f $(which javac) 2>/dev/null) fi if [ -z "$JAVAC" ]; then JAVAC=$(which javac) fi if [ -z "$JAVAC" ] ; then exit 1 fi while [ -L "$JAVAC" ] ; do LSLINE=$(ls -l "$JAVAC") JAVAC=$(echo -n "$LSLINE" | sed -e "s/.* -> //") done echo $JAVAC | sed -e 's:\(.*\)/javac$:\1/../lib/tools.jar:' fi envsetup.sh +48 −5 Original line number Diff line number Diff line Loading @@ -248,11 +248,13 @@ function setpaths() export PATH=$ANDROID_BUILD_PATHS$PATH export PYTHONPATH=$T/development/python-packages:$PYTHONPATH export ANDROID_JAVA_HOME=$(get_abs_build_var ANDROID_JAVA_HOME) export JAVA_HOME=$ANDROID_JAVA_HOME export ANDROID_JAVA_TOOLCHAIN=$(get_abs_build_var ANDROID_JAVA_TOOLCHAIN) unset ANDROID_JAVA_TOOLCHAIN unset ANDROID_PRE_BUILD_PATHS if [ -n "$JAVA_HOME" ]; then export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN: export PATH=$ANDROID_PRE_BUILD_PATHS$PATH fi unset ANDROID_PRODUCT_OUT export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT) Loading Loading @@ -285,6 +287,7 @@ function printconfig() function set_stuff_for_environment() { settitle set_java_home setpaths set_sequence_number Loading Loading @@ -1527,6 +1530,46 @@ function godir () { \cd $T/$pathname } # Force JAVA_HOME to point to java 1.7/1.8 if it isn't already set. 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 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. if [ -n "$ANDROID_SET_JAVA_HOME" ]; then export JAVA_HOME="" fi if [ ! "$JAVA_HOME" ]; then if [ -n "$LEGACY_USE_JAVA7" ]; then echo Warning: Support for JDK 7 will be dropped. Switch to JDK 8. case `uname -s` in Darwin) export JAVA_HOME=$(/usr/libexec/java_home -v 1.7) ;; *) export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 ;; esac else case `uname -s` in Darwin) export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ;; *) export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 ;; esac fi # Keep track of the fact that we set JAVA_HOME ourselves, so that # we can change it on the next envsetup.sh, if required. export ANDROID_SET_JAVA_HOME=true fi } # Print colored exit condition function pez { "$@" Loading Loading
core/combo/javac.mk +12 −8 Original line number Diff line number Diff line Loading @@ -16,20 +16,16 @@ endif common_jdk_flags := -Xmaxerrs 9999999 ANDROID_JAVA_HOME := prebuilts/jdk/jdk8/$(HOST_PREBUILT_TAG) ANDROID_JAVA_TOOLCHAIN := $(ANDROID_JAVA_HOME)/bin export JAVA_HOME := $(ANDROID_JAVA_HOME) # Use the indexer wrapper to index the codebase instead of the javac compiler ifeq ($(ALTERNATE_JAVAC),) JAVACC := $(ANDROID_JAVA_TOOLCHAIN)/javac JAVACC := javac else JAVACC := $(ALTERNATE_JAVAC) endif JAVA := $(ANDROID_JAVA_TOOLCHAIN)/java JAVADOC := $(ANDROID_JAVA_TOOLCHAIN)/javadoc JAR := $(ANDROID_JAVA_TOOLCHAIN)/jar JAVA := java JAVADOC := javadoc JAR := jar # The actual compiler can be wrapped by setting the JAVAC_WRAPPER var. ifdef JAVAC_WRAPPER Loading @@ -38,8 +34,16 @@ ifdef JAVAC_WRAPPER endif endif # Whatever compiler is on this system. COMMON_JAVAC := $(JAVACC) -J-Xmx2048M $(common_jdk_flags) # Eclipse. ifeq ($(CUSTOM_JAVA_COMPILER), eclipse) COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \ -maxProblems 9999999 -nowarn $(info CUSTOM_JAVA_COMPILER=eclipse) endif GLOBAL_JAVAC_DEBUG_FLAGS := -g HOST_JAVAC ?= $(COMMON_JAVAC) Loading
core/config.mk +11 −12 Original line number Diff line number Diff line Loading @@ -676,13 +676,22 @@ ANDROID_MANIFEST_MERGER := $(JAVA) -classpath prebuilts/devtools/tools/lib/manif COLUMN:= column # We may not have the right JAVA_HOME/PATH set up yet when this is run from envsetup.sh. ifneq ($(CALLED_FROM_SETUP),true) # Path to tools.jar, or empty if EXPERIMENTAL_USE_OPENJDK9 is set HOST_JDK_TOOLS_JAR := # TODO: Remove HOST_JDK_TOOLS_JAR and all references to it once OpenJDK 8 # toolchains are no longer supported (i.e. when what is now # EXPERIMENTAL_USE_OPENJDK9 becomes the standard). http://b/38418220 ifeq ($(EXPERIMENTAL_USE_OPENJDK9),) HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA_TOOLCHAIN)/../lib/tools.jar HOST_JDK_TOOLS_JAR := $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh) ifneq ($(HOST_JDK_TOOLS_JAR),) ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),) $(error Error: could not find jdk tools.jar at $(HOST_JDK_TOOLS_JAR), please check if your JDK was installed correctly) endif endif endif # ifeq ($(EXPERIMENTAL_USE_OPENJDK9),) # Is the host JDK 64-bit version? Loading @@ -690,6 +699,7 @@ HOST_JDK_IS_64BIT_VERSION := ifneq ($(filter 64-Bit, $(shell $(JAVA) -version 2>&1)),) HOST_JDK_IS_64BIT_VERSION := true endif endif # CALLED_FROM_SETUP not true # It's called md5 on Mac OS and md5sum on Linux ifeq ($(HOST_OS),darwin) Loading Loading @@ -844,17 +854,6 @@ unexport ANDROID_JAVA_HOME unexport JAVA_HOME export ANDROID_BUILD_PATHS:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(ANDROID_BUILD_PATHS) export PATH:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(PATH) else # Put java first on the path # TODO(ccross): remove this once tools run during the build no longer depend on # finding java in the path ifeq (,$(strip $(CALLED_FROM_SETUP))) ifneq ($(shell which java),$(abspath $(ANDROID_JAVA_TOOLCHAIN)/java)) $(warning Found incorrect java $(shell which java) in $$PATH) $(warning Adding $(abspath $(ANDROID_JAVA_TOOLCHAIN)) to $$PATH) export PATH:=$(abspath $(ANDROID_JAVA_TOOLCHAIN)):$(PATH) endif endif endif # Projects clean of compiler warnings should be compiled with -Werror. Loading
core/find-jdk-tools-jar.sh 0 → 100755 +20 −0 Original line number Diff line number Diff line #!/bin/sh if [ "x$ANDROID_JAVA_HOME" != x ] && [ -e "$ANDROID_JAVA_HOME/lib/tools.jar" ] ; then echo $ANDROID_JAVA_HOME/lib/tools.jar else JAVAC=$(realpath $(which javac) 2>/dev/null) if [ -z "$JAVAC" ]; then JAVAC=$(readlink -f $(which javac) 2>/dev/null) fi if [ -z "$JAVAC" ]; then JAVAC=$(which javac) fi if [ -z "$JAVAC" ] ; then exit 1 fi while [ -L "$JAVAC" ] ; do LSLINE=$(ls -l "$JAVAC") JAVAC=$(echo -n "$LSLINE" | sed -e "s/.* -> //") done echo $JAVAC | sed -e 's:\(.*\)/javac$:\1/../lib/tools.jar:' fi
envsetup.sh +48 −5 Original line number Diff line number Diff line Loading @@ -248,11 +248,13 @@ function setpaths() export PATH=$ANDROID_BUILD_PATHS$PATH export PYTHONPATH=$T/development/python-packages:$PYTHONPATH export ANDROID_JAVA_HOME=$(get_abs_build_var ANDROID_JAVA_HOME) export JAVA_HOME=$ANDROID_JAVA_HOME export ANDROID_JAVA_TOOLCHAIN=$(get_abs_build_var ANDROID_JAVA_TOOLCHAIN) unset ANDROID_JAVA_TOOLCHAIN unset ANDROID_PRE_BUILD_PATHS if [ -n "$JAVA_HOME" ]; then export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN: export PATH=$ANDROID_PRE_BUILD_PATHS$PATH fi unset ANDROID_PRODUCT_OUT export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT) Loading Loading @@ -285,6 +287,7 @@ function printconfig() function set_stuff_for_environment() { settitle set_java_home setpaths set_sequence_number Loading Loading @@ -1527,6 +1530,46 @@ function godir () { \cd $T/$pathname } # Force JAVA_HOME to point to java 1.7/1.8 if it isn't already set. 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 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. if [ -n "$ANDROID_SET_JAVA_HOME" ]; then export JAVA_HOME="" fi if [ ! "$JAVA_HOME" ]; then if [ -n "$LEGACY_USE_JAVA7" ]; then echo Warning: Support for JDK 7 will be dropped. Switch to JDK 8. case `uname -s` in Darwin) export JAVA_HOME=$(/usr/libexec/java_home -v 1.7) ;; *) export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 ;; esac else case `uname -s` in Darwin) export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ;; *) export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 ;; esac fi # Keep track of the fact that we set JAVA_HOME ourselves, so that # we can change it on the next envsetup.sh, if required. export ANDROID_SET_JAVA_HOME=true fi } # Print colored exit condition function pez { "$@" Loading