Revert "Use java prebuilts"
This reverts commit 193175094081e9cc3c44e2b3ee290195b1b89613.
Change-Id: I7a99fd6c53d35a2a674f2d60b113a727f3c453ce
diff --git a/core/config.mk b/core/config.mk
index 00a3c3b..f839d3d 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -675,13 +675,22 @@
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?
@@ -689,6 +698,7 @@
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)
@@ -838,17 +848,6 @@
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.