Add support for specifying LOCAL_SDK_LIBRARIES for prebuilts.

This new variable allows specifying libraries like this:
LOCAL_SDK_VERISON := 25
LOCAL_SDK_LIBRARIES := org.apache.http.legacy,
which would automatically pick up the prebuilt OAHL prebuilt
from prebuilts/sdk/25/public/org.apache.http.legacy.jar

Test: In master with uiautomator.
Bug: 77575476
Change-Id: Id8d92176f5b608c2bcea622b6aed4aa27c32e000
This commit is contained in:
Anton Hansson 2018-04-12 16:17:55 +01:00
parent 2944c11b1f
commit f5cefdcefb
3 changed files with 10 additions and 7 deletions

View file

@ -229,6 +229,7 @@ LOCAL_SANITIZE:=
LOCAL_SANITIZE_DIAG:=
LOCAL_SANITIZE_RECOVER:=
LOCAL_SANITIZE_BLACKLIST :=
LOCAL_SDK_LIBRARIES :=
LOCAL_SDK_RES_VERSION:=
LOCAL_SDK_VERSION:=
LOCAL_SHARED_ANDROID_LIBRARIES:=

View file

@ -963,10 +963,11 @@ endif
# 23 -> sdk_public_23_android
# system_current -> sdk_system_current_android
# $(1): An sdk version (LOCAL_SDK_VERSION)
# $(2): optional library name (default: android)
define resolve-prebuilt-sdk-module
$(if $(findstring _,$(1)),\
sdk_$(1)_android,\
sdk_public_$(1)_android)
sdk_$(1)_$(or $(2),android),\
sdk_public_$(1)_$(or $(2),android))
endef
# Resolve LOCAL_SDK_VERSION to prebuilt framework.aidl

View file

@ -230,6 +230,7 @@ empty_bootclasspath :=
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.
@ -261,9 +262,10 @@ ifndef LOCAL_IS_HOST_MODULE
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 is set. Use the modules defined in prebuilts/sdk/Android.mk.
# 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))
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
endif # LOCAL_SDK_VERSION
@ -291,10 +293,9 @@ ifndef LOCAL_IS_HOST_MODULE
full_java_bootclasspath_libs += $(call java-lib-header-files,core-lambda-stubs)
endif
endif
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES) $(sdk_libs),$(LOCAL_IS_HOST_MODULE))
full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES) $(sdk_libs),$(LOCAL_IS_HOST_MODULE))
sdk_libs :=
else # LOCAL_IS_HOST_MODULE
ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)