forked from openkylin/platform_build
Merge "Use java prebuilts" am: 45d2ef40f2
am: d35fe2c55e
am: 1589539f10
Change-Id: Ie701576175eef2469de22e68623a6914ca20239d
This commit is contained in:
commit
19bd3427d0
|
@ -16,16 +16,20 @@ endif
|
||||||
|
|
||||||
common_jdk_flags := -Xmaxerrs 9999999
|
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
|
# Use the indexer wrapper to index the codebase instead of the javac compiler
|
||||||
ifeq ($(ALTERNATE_JAVAC),)
|
ifeq ($(ALTERNATE_JAVAC),)
|
||||||
JAVACC := javac
|
JAVACC := $(ANDROID_JAVA_TOOLCHAIN)/javac
|
||||||
else
|
else
|
||||||
JAVACC := $(ALTERNATE_JAVAC)
|
JAVACC := $(ALTERNATE_JAVAC)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
JAVA := java
|
JAVA := $(ANDROID_JAVA_TOOLCHAIN)/java
|
||||||
JAVADOC := javadoc
|
JAVADOC := $(ANDROID_JAVA_TOOLCHAIN)/javadoc
|
||||||
JAR := jar
|
JAR := $(ANDROID_JAVA_TOOLCHAIN)/jar
|
||||||
|
|
||||||
# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var.
|
# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var.
|
||||||
ifdef JAVAC_WRAPPER
|
ifdef JAVAC_WRAPPER
|
||||||
|
@ -34,16 +38,8 @@ ifdef JAVAC_WRAPPER
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Whatever compiler is on this system.
|
|
||||||
COMMON_JAVAC := $(JAVACC) -J-Xmx2048M $(common_jdk_flags)
|
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
|
GLOBAL_JAVAC_DEBUG_FLAGS := -g
|
||||||
|
|
||||||
HOST_JAVAC ?= $(COMMON_JAVAC)
|
HOST_JAVAC ?= $(COMMON_JAVAC)
|
||||||
|
|
|
@ -676,22 +676,13 @@ ANDROID_MANIFEST_MERGER := $(JAVA) -classpath prebuilts/devtools/tools/lib/manif
|
||||||
|
|
||||||
COLUMN:= column
|
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
|
# Path to tools.jar, or empty if EXPERIMENTAL_USE_OPENJDK9 is set
|
||||||
HOST_JDK_TOOLS_JAR :=
|
HOST_JDK_TOOLS_JAR :=
|
||||||
# TODO: Remove HOST_JDK_TOOLS_JAR and all references to it once OpenJDK 8
|
# 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
|
# toolchains are no longer supported (i.e. when what is now
|
||||||
# EXPERIMENTAL_USE_OPENJDK9 becomes the standard). http://b/38418220
|
# EXPERIMENTAL_USE_OPENJDK9 becomes the standard). http://b/38418220
|
||||||
ifeq ($(EXPERIMENTAL_USE_OPENJDK9),)
|
ifeq ($(EXPERIMENTAL_USE_OPENJDK9),)
|
||||||
HOST_JDK_TOOLS_JAR := $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
|
HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA_TOOLCHAIN)/../lib/tools.jar
|
||||||
|
|
||||||
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),)
|
endif # ifeq ($(EXPERIMENTAL_USE_OPENJDK9),)
|
||||||
|
|
||||||
# Is the host JDK 64-bit version?
|
# Is the host JDK 64-bit version?
|
||||||
|
@ -699,7 +690,6 @@ HOST_JDK_IS_64BIT_VERSION :=
|
||||||
ifneq ($(filter 64-Bit, $(shell $(JAVA) -version 2>&1)),)
|
ifneq ($(filter 64-Bit, $(shell $(JAVA) -version 2>&1)),)
|
||||||
HOST_JDK_IS_64BIT_VERSION := true
|
HOST_JDK_IS_64BIT_VERSION := true
|
||||||
endif
|
endif
|
||||||
endif # CALLED_FROM_SETUP not true
|
|
||||||
|
|
||||||
# It's called md5 on Mac OS and md5sum on Linux
|
# It's called md5 on Mac OS and md5sum on Linux
|
||||||
ifeq ($(HOST_OS),darwin)
|
ifeq ($(HOST_OS),darwin)
|
||||||
|
@ -885,6 +875,17 @@ unexport ANDROID_JAVA_HOME
|
||||||
unexport JAVA_HOME
|
unexport JAVA_HOME
|
||||||
export ANDROID_BUILD_PATHS:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(ANDROID_BUILD_PATHS)
|
export ANDROID_BUILD_PATHS:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(ANDROID_BUILD_PATHS)
|
||||||
export PATH:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(PATH)
|
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
|
endif
|
||||||
|
|
||||||
# Projects clean of compiler warnings should be compiled with -Werror.
|
# Projects clean of compiler warnings should be compiled with -Werror.
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
#!/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
|
|
49
envsetup.sh
49
envsetup.sh
|
@ -258,13 +258,11 @@ function setpaths()
|
||||||
export PATH=$ANDROID_BUILD_PATHS$PATH
|
export PATH=$ANDROID_BUILD_PATHS$PATH
|
||||||
export PYTHONPATH=$T/development/python-packages:$PYTHONPATH
|
export PYTHONPATH=$T/development/python-packages:$PYTHONPATH
|
||||||
|
|
||||||
unset ANDROID_JAVA_TOOLCHAIN
|
export ANDROID_JAVA_HOME=$(get_abs_build_var ANDROID_JAVA_HOME)
|
||||||
unset ANDROID_PRE_BUILD_PATHS
|
export JAVA_HOME=$ANDROID_JAVA_HOME
|
||||||
if [ -n "$JAVA_HOME" ]; then
|
export ANDROID_JAVA_TOOLCHAIN=$(get_abs_build_var ANDROID_JAVA_TOOLCHAIN)
|
||||||
export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin
|
|
||||||
export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN:
|
export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN:
|
||||||
export PATH=$ANDROID_PRE_BUILD_PATHS$PATH
|
export PATH=$ANDROID_PRE_BUILD_PATHS$PATH
|
||||||
fi
|
|
||||||
|
|
||||||
unset ANDROID_PRODUCT_OUT
|
unset ANDROID_PRODUCT_OUT
|
||||||
export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT)
|
export ANDROID_PRODUCT_OUT=$(get_abs_build_var PRODUCT_OUT)
|
||||||
|
@ -297,7 +295,6 @@ function printconfig()
|
||||||
function set_stuff_for_environment()
|
function set_stuff_for_environment()
|
||||||
{
|
{
|
||||||
settitle
|
settitle
|
||||||
set_java_home
|
|
||||||
setpaths
|
setpaths
|
||||||
set_sequence_number
|
set_sequence_number
|
||||||
|
|
||||||
|
@ -1540,46 +1537,6 @@ function godir () {
|
||||||
\cd $T/$pathname
|
\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
|
# Print colored exit condition
|
||||||
function pez {
|
function pez {
|
||||||
"$@"
|
"$@"
|
||||||
|
|
Loading…
Reference in New Issue