From 8ae30017e9cc595592f09d7d16c0d8ad68784fcd Mon Sep 17 00:00:00 2001 From: Anton Hansson Date: Tue, 24 Apr 2018 14:22:51 +0100 Subject: [PATCH] Support LOCAL_SDK_LIBRARIES for "current" builds. Resolve these using the naming scheme from sdk_library.go, added in I4a4ccf6e730e041703c63bb275d8860d0de96887. Also re-write the LOCAL_SDK_VERSION logic, as it was becoming a real mess. Bug: 77575476 Test: With uiautomator in a follow-on CL Change-Id: I11bd10c02df3d458a4ed6de90114e27fabe8d9e0 --- core/java_common.mk | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/core/java_common.mk b/core/java_common.mk index 0de8e92489..9245e201f0 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -231,6 +231,7 @@ my_system_modules := ifndef LOCAL_IS_HOST_MODULE sdk_libs := + ifeq ($(LOCAL_SDK_VERSION),) ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) # No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath. @@ -252,22 +253,30 @@ ifndef LOCAL_IS_HOST_MODULE $(call pretty-error,Invalid LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)' \ Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS)) endif - ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) - # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS. - full_java_bootclasspath_libs := $(call java-lib-header-files,android_stubs_current) - else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current) - full_java_bootclasspath_libs := $(call java-lib-header-files,android_system_stubs_current) - else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current) - full_java_bootclasspath_libs := $(call java-lib-header-files,android_test_stubs_current) - else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),core_current) - full_java_bootclasspath_libs := $(call java-lib-header-files,core.current.stubs) - else - # TARGET_BUILD_APPS or numbered SDK. Use the modules defined in prebuilts/sdk/Android.mk. - _module_name := $(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION)) - full_java_bootclasspath_libs := $(call java-lib-header-files,$(_module_name)) + + ifneq (,$(TARGET_BUILD_APPS)$(filter-out %current,$(LOCAL_SDK_VERSION))) + # TARGET_BUILD_APPS mode or numbered SDK. Use prebuilt modules. + sdk_module := $(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION)) sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(call resolve-prebuilt-sdk-module,$(LOCAL_SDK_VERSION),$(lib_name))) - _module_name := - endif # current, system_current, system_${VER}, test_current or core_current + else + # Note: the lib naming scheme must be kept in sync with build/soong/java/sdk_library.go. + sdk_lib_suffix = $(call pretty-error,sdk_lib_suffix was not set correctly) + ifeq (current,$(LOCAL_SDK_VERSION)) + sdk_module := android_stubs_current + sdk_lib_suffix := .stubs + else ifeq (system_current,$(LOCAL_SDK_VERSION)) + sdk_module := android_system_stubs_current + sdk_lib_suffix := .stubs.system + else ifeq (test_current,$(LOCAL_SDK_VERSION)) + sdk_module := android_test_stubs_current + sdk_lib_suffix = $(call pretty-error,LOCAL_SDK_LIBRARIES not supported for LOCAL_SDK_VERSION = test_current) + else ifeq (core_current,$(LOCAL_SDK_VERSION)) + sdk_module := core.current.stubs + sdk_lib_suffix = $(call pretty-error,LOCAL_SDK_LIBRARIES not supported for LOCAL_SDK_VERSION = core_current) + endif + sdk_libs := $(foreach lib_name,$(LOCAL_SDK_LIBRARIES),$(lib_name)$(sdk_lib_suffix)) + endif + full_java_bootclasspath_libs := $(call java-lib-header-files,$(sdk_module)) endif # LOCAL_SDK_VERSION ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)