forked from openkylin/platform_build
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
Merged-In: I826d8ac513a41a1d6d5e29a8300073158cff5acf
Change-Id: I826d8ac513a41a1d6d5e29a8300073158cff5acf
(cherry picked from commit a39db48511
)
This commit is contained in:
parent
4788f5b094
commit
ab501e0d8b
|
@ -1047,6 +1047,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
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue