From 79d8bf25ead746229621f63de28306ac1ef2d596 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Mon, 22 Oct 2018 13:08:34 +0100 Subject: [PATCH] Allow UnsupportedAppUsage annotations to be in separate target Previously, all the UnsupportedAppUsage annotations were assumed to be in the same target as was used at runtime. e.g. frameworks, core-libart, etc. This change allows separate targets to be specified in the EXTRA_HIDDENAPI_JARS. It is needed to avoid maintaining local patches for those annotations in the libcore/ojluni/src/main/java code which comes from upstream OpenJDK. This was tested by making and then manually checking that the generated out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt was the same (after sorting) before and after this change. Test: see above Bug: 117818301 Change-Id: Icfadbe52601371f6a4cabef106750b16f6c6d4c8 --- core/config.mk | 5 +++++ core/soong_java_prebuilt.mk | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/core/config.mk b/core/config.mk index 3289a898f..0e38dbe20 100644 --- a/core/config.mk +++ b/core/config.mk @@ -204,6 +204,11 @@ else JAVA_TMPDIR_ARG := endif +# A list of the jars that provide information about usages of the hidden API. +# The core-oj-hiddenapi provides information for the core-oj jar. +HIDDENAPI_EXTRA_APP_USAGE_JARS := \ + core-oj-hiddenapi \ + # Default to remove the org.apache.http.legacy from bootclasspath ifeq ($(REMOVE_OAHL_FROM_BCP),) REMOVE_OAHL_FROM_BCP := true diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk index 288a763ce..01af19fb9 100644 --- a/core/soong_java_prebuilt.mk +++ b/core/soong_java_prebuilt.mk @@ -120,6 +120,15 @@ $(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar) java-dex : $(LOCAL_BUILT_MODULE) else # LOCAL_UNINSTALLABLE_MODULE + + ifneq ($(filter $(LOCAL_MODULE),$(HIDDENAPI_EXTRA_APP_USAGE_JARS)),) + # Derive greylist from classes.jar. + # We use full_classes_jar here, which is the post-proguard jar (on the basis that we also + # have a full_classes_pre_proguard_jar). This is consistent with the equivalent code in + # java.mk. + $(eval $(call hiddenapi-generate-greylist-txt,$(full_classes_jar),$(hiddenapi_whitelist_txt),$(hiddenapi_greylist_txt),$(hiddenapi_darkgreylist_txt),$(hiddenapi_greylist_metadata_csv))) + endif + $(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE))) $(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar))) java-dex : $(common_javalib.jar)