From 4f2f19518eb21aba563c0890bd1ccb441384bbda Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Mon, 23 Nov 2015 14:57:26 -0800 Subject: [PATCH] Set -bootclasspath to "" if LOCAL_NO_STANDARD_LIBRARIES Without this if a Java libraryw with LOCAL_NO_STANDARD_LIBRARIES doesn't have core-libart in its LOCAL_JAVA_LIBRARIES, it would use core-libart as bootclasspath but without having dependency on it. Change-Id: I611a5a5df2bf0ad59e0be50ed1ad1afe8b843e90 (cherry-pick from commit c6a301756cd6bc58691cde69513b28e7ee0d1ac6) --- core/java_common.mk | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/core/java_common.mk b/core/java_common.mk index b7f07ab18..6694f16e6 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -133,17 +133,23 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS) # be up-to-date. ifndef LOCAL_IS_HOST_MODULE ifeq ($(LOCAL_SDK_VERSION),) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-libart) +ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) +# No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath. +my_bootclasspath := "" +else # LOCAL_NO_STANDARD_LIBRARIES +my_bootclasspath := $(call java-lib-files,core-libart) +endif # LOCAL_NO_STANDARD_LIBRARIES else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS. -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_stubs_current) +my_bootclasspath := $(call java-lib-files,android_stubs_current) else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_system_stubs_current) +my_bootclasspath := $(call java-lib-files,android_system_stubs_current) else -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION)) +my_bootclasspath := $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION)) endif # current or system_current endif # LOCAL_SDK_VERSION +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath) full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) @@ -152,7 +158,12 @@ full_java_lib_deps := $(addsuffix .toc, $(full_java_lib_deps)) else # LOCAL_IS_HOST_MODULE ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE)) +ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) +my_bootclasspath := "" +else +my_bootclasspath := $(call java-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE)) +endif +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath) full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) \ @@ -263,17 +274,22 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JACK_LIBRARIES := $(full_static_ja ifndef LOCAL_IS_HOST_MODULE ifeq ($(LOCAL_SDK_VERSION),) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,core-libart) +ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) +my_bootclasspath := else +my_bootclasspath := $(call jack-lib-files,core-libart) +endif +else # LOCAL_SDK_VERSION ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS. -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,android_stubs_current) +my_bootclasspath := $(call jack-lib-files,android_stubs_current) else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,android_system_stubs_current) +my_bootclasspath := $(call jack-lib-files,android_system_stubs_current) else -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,sdk_v$(LOCAL_SDK_VERSION)) +my_bootclasspath :=$(call jack-lib-files,sdk_v$(LOCAL_SDK_VERSION)) endif # current or system_current endif # LOCAL_SDK_VERSION +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_bootclasspath) full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) @@ -281,7 +297,12 @@ full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HO else # LOCAL_IS_HOST_MODULE ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE)) +ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) +my_bootclasspath := +else +my_bootclasspath := $(call jack-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE)) +endif +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_bootclasspath) full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) else