From 42669e6dc72a1a3678d999c827671cdb9aebee15 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 30 Apr 2018 15:59:16 -0700 Subject: [PATCH] Allow Soong to export multiple proguard flags files Soong uses lists of proguard flags files from dependencies instead of a single concatenated file. Allow Soong to pass the list to make, which will concatenate it. Move the check inside ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE in case Soong exports an Android library with an empty LOCAL_SOONG_EXPORT_PROGUARD_FLAGS. Bug: 73724997 Test: m checkbuild Change-Id: Ia8f229ec5f9fc99a23bd471dfa70c9de7316de94 --- core/soong_java_prebuilt.mk | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk index 96ff376268..3773c07319 100644 --- a/core/soong_java_prebuilt.mk +++ b/core/soong_java_prebuilt.mk @@ -40,21 +40,26 @@ ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR $(intermediates.COMMON)/jacoco-report-classes.jar) endif -ifdef LOCAL_SOONG_EXPORT_PROGUARD_FLAGS - $(eval $(call copy-one-file,$(LOCAL_SOONG_EXPORT_PROGUARD_FLAGS),\ - $(intermediates.COMMON)/export_proguard_flags)) - $(call add-dependency,$(LOCAL_BUILT_MODULE),\ - $(intermediates.COMMON)/export_proguard_flags) -endif - ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE -my_res_package := $(intermediates.COMMON)/package-res.apk + my_res_package := $(intermediates.COMMON)/package-res.apk -$(my_res_package): $(LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE) + $(my_res_package): $(LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE) @echo "Copy: $@" $(copy-file-to-target) -$(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_res_package)) + $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_res_package)) + + my_proguard_flags := $(intermediates.COMMON)/export_proguard_flags + $(my_proguard_flags): $(LOCAL_SOONG_EXPORT_PROGUARD_FLAGS) + @echo "Export proguard flags: $@" + rm -f $@ + touch $@ + for f in $+; do \ + echo -e "\n# including $$f" >>$@; \ + cat $$f >>$@; \ + done + + $(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_proguard_flags)) endif # LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE