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
This commit is contained in:
Anton Hansson 2018-04-24 14:22:51 +01:00
parent a22472315f
commit 8ae30017e9
1 changed files with 24 additions and 15 deletions

View File

@ -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)