Build rules to derive greylists from annotations.
Uses the new class2greylist tool to extract API descriptors from .class
files.
Also add these generated greylist.txt files as dependencies of
INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST so they can be merged later in
the build.
Bug: 110868826
Test: m
Change-Id: I406587732b537f9b56768ad9909039dfab34c334
diff --git a/core/definitions.mk b/core/definitions.mk
index 7108e09..4341c62 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2866,6 +2866,16 @@
PRIVATE_DEX_INPUTS := $$(PRIVATE_DEX_INPUTS) $(1)
endef
+# Generate a greylist.txt from a classes.jar
+define hiddenapi-generate-greylist-txt
+$(2): $(1) $(CLASS2GREYLIST)
+ $(CLASS2GREYLIST) $(1) > $(2)
+
+$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST): $(2)
+$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST): \
+ PRIVATE_GREYLIST_INPUTS := $$(PRIVATE_GREYLIST_INPUTS) $(2)
+endef
+
# File names for intermediate dex files of `hiddenapi-copy-soong-jar`.
hiddenapi-soong-input-dex = $(dir $(1))/hiddenapi/dex-input/classes.dex
hiddenapi-soong-output-dex = $(dir $(1))/hiddenapi/dex-output/classes.dex