Add singleton rule for hiddenapi list generation
The lists of public/private APIs used for non-SDK API restriction enforcement used to be generated by Doclava. In Q we're switching to resolving android.jar (and other SDK stub JARs) against the boot class path directly to avoid lowering Doclava's high-level view of the framework and issues related to it. This patch adds a new build rule which invokes `hiddenapi` on all boot class path dex files simultaneously. The tool generates two text files - one with public and one with private APIs. Bug: 79409988 Test: m out/target/common/obj/PACKAGING/hiddenapi-private-list.txt Change-Id: I826d8ac513a41a1d6d5e29a8300073158cff5acf
This commit is contained in:
parent
12626438eb
commit
a39db48511
3 changed files with 40 additions and 0 deletions
|
@ -1083,6 +1083,8 @@ ifndef INTERNAL_PLATFORM_SYSTEM_PRIVATE_DEX_API_FILE
|
|||
INTERNAL_PLATFORM_SYSTEM_PRIVATE_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-private-dex.txt
|
||||
endif
|
||||
|
||||
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
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -90,6 +90,39 @@ 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)
|
||||
|
||||
ifeq ($(PRODUCT_DIST_BOOT_AND_SYSTEM_JARS),true)
|
||||
boot_profile_jars_zip := $(PRODUCT_OUT)/boot_profile_jars.zip
|
||||
all_boot_jars := \
|
||||
|
|
Loading…
Reference in a new issue