Merge "Disable java when JAVA_NOT_REQUIRED is set"

am: 74606c40cd

* commit '74606c40cdf0552c58b07b1477e79690e6037930':
  Disable java when JAVA_NOT_REQUIRED is set
This commit is contained in:
Dan Willemsen 2016-02-09 05:26:08 +00:00 committed by android-build-merger
commit 3714f7876c
7 changed files with 21 additions and 5 deletions

View File

@ -855,4 +855,12 @@ endif
RSCOMPAT_32BIT_ONLY_API_LEVELS := 8 9 10 11 12 13 14 15 16 17 18 19 20
RSCOMPAT_NO_USAGEIO_API_LEVELS := 8 9 10 11 12 13
ifeq ($(JAVA_NOT_REQUIRED),true)
# Remove java and tools from our path so that we make sure nobody uses them.
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)
endif
include $(BUILD_SYSTEM)/dumpvar.mk

View File

@ -57,9 +57,6 @@ TOPDIR :=
BUILD_SYSTEM := $(TOPDIR)build/core
# Ensure JAVA_NOT_REQUIRED is not set externally.
JAVA_NOT_REQUIRED := false
# This is the default target. It must be the first declared target.
.PHONY: droid
DEFAULT_GOAL := droid
@ -148,8 +145,9 @@ include $(BUILD_SYSTEM)/cleanbuild.mk
-include vendor/google/build/config.mk
VERSION_CHECK_SEQUENCE_NUMBER := 6
JAVA_NOT_REQUIRED_CHECKED :=
-include $(OUT_DIR)/versions_checked.mk
ifneq ($(VERSION_CHECK_SEQUENCE_NUMBER),$(VERSIONS_CHECKED))
ifneq ($(VERSION_CHECK_SEQUENCE_NUMBER)$(JAVA_NOT_REQUIRED),$(VERSIONS_CHECKED)$(JAVA_NOT_REQUIRED_CHECKED))
$(info Checking build tools versions...)
@ -180,7 +178,7 @@ $(warning ************************************************************)
$(error Directory names containing spaces not supported)
endif
ifeq ($(JAVA_NOT_REQUIRED), false)
ifneq ($(JAVA_NOT_REQUIRED),true)
java_version_str := $(shell unset _JAVA_OPTIONS && java -version 2>&1)
javac_version_str := $(shell unset _JAVA_OPTIONS && javac -version 2>&1)
@ -271,6 +269,8 @@ $(shell echo 'VERSIONS_CHECKED := $(VERSION_CHECK_SEQUENCE_NUMBER)' \
> $(OUT_DIR)/versions_checked.mk)
$(shell echo 'BUILD_EMULATOR ?= $(BUILD_EMULATOR)' \
>> $(OUT_DIR)/versions_checked.mk)
$(shell echo 'JAVA_NOT_REQUIRED_CHECKED := $(JAVA_NOT_REQUIRED)' \
>> $(OUT_DIR)/versions_checked.mk)
endif
# These are the modifier targets that don't do anything themselves, but

1
core/no_java_path/jar Symbolic link
View File

@ -0,0 +1 @@
java

1
core/no_java_path/jarsigner Symbolic link
View File

@ -0,0 +1 @@
java

4
core/no_java_path/java Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
echo "Error: JAVA_NOT_REQUIRED=true, $(basename $0) is unavailable." 1>&2
exit 1

1
core/no_java_path/javac Symbolic link
View File

@ -0,0 +1 @@
java

1
core/no_java_path/keytool Symbolic link
View File

@ -0,0 +1 @@
java