Merge "Add singleton rule for hiddenapi list generation"

This commit is contained in:
David Brazdil 2018-07-12 21:34:54 +00:00 committed by Gerrit Code Review
commit dc39f73d5b
3 changed files with 40 additions and 0 deletions

View file

@ -1036,6 +1036,8 @@ TARGET_AVAIALBLE_SDK_VERSIONS := $(call numerically_sort,$(TARGET_AVAILABLE_SDK_
TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT := $(call numbers_less_than,24,$(TARGET_AVAILABLE_SDK_VERSIONS))
TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,27,$(TARGET_AVAILABLE_SDK_VERSIONS))
INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-public-list.txt
INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-private-list.txt
INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-light-greylist.txt
INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-dark-greylist.txt
INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-blacklist.txt

View file

@ -2837,6 +2837,7 @@ fi
endef
# Copy dex files, invoking $(HIDDENAPI) on them in the process.
# Also make the source dex file an input of the hiddenapi singleton rule in dex_preopt.mk.
define hiddenapi-copy-dex-files
$(2): $(1) $(HIDDENAPI) $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
@ -2848,6 +2849,10 @@ $(2): $(1) $(HIDDENAPI) $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
--light-greylist=$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
--dark-greylist=$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) \
--blacklist=$(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): $(1)
$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): \
PRIVATE_DEX_INPUTS := $$(PRIVATE_DEX_INPUTS) $(1)
endef
# File names for intermediate dex files of `hiddenapi-copy-soong-jar`.

View file

@ -89,3 +89,36 @@ DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEFAULT_DEX_PREOPT_BUILT_IM
ifdef TARGET_2ND_ARCH
$(TARGET_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
endif # TARGET_2ND_ARCH
# === hiddenapi rules ===
hiddenapi_stubs_jar = $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
# Public API stubs
HIDDENAPI_STUBS := \
$(call hiddenapi_stubs_jar,android_stubs_current) \
$(call hiddenapi_stubs_jar,android.test.base.stubs) \
$(call hiddenapi_stubs_jar,android.test.mock.stubs) \
$(call hiddenapi_stubs_jar,android.test.runner.stubs)
# System API stubs
HIDDENAPI_STUBS += \
$(call hiddenapi_stubs_jar,android_system_stubs_current)
# Test API stubs
HIDDENAPI_STUBS += \
$(call hiddenapi_stubs_jar,android_test_stubs_current)
# Singleton rule which applies $(HIDDENAPI) on all boot class path dex files.
# Inputs are filled with `hiddenapi-copy-dex-files` rules.
$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): \
PRIVATE_HIDDENAPI_STUBS := $(HIDDENAPI_STUBS)
$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): \
.KATI_IMPLICIT_OUTPUTS := $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST)
$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): $(HIDDENAPI) $(HIDDENAPI_STUBS)
for INPUT_DEX in $(PRIVATE_DEX_INPUTS); do \
find `dirname $${INPUT_DEX}` -maxdepth 1 -name "classes*.dex"; \
done | sort | sed 's/^/--boot-dex=/' | xargs $(HIDDENAPI) list \
$(addprefix --stub-dex=,$(PRIVATE_HIDDENAPI_STUBS)) \
--out-public=$(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST) \
--out-private=$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST)