From 4cdbaf118692f42620db6ba3e6af1f035bb48476 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Fri, 9 Feb 2018 15:19:11 -0800 Subject: [PATCH] Revert "Revert "Propagate proguard rules from LOCAL_STATIC_ANDROID_LIBRARIES"" This reverts commit 30d6869faf6f288002d3d2181bc50e79ddc04fb2. Fixes an issue with the original change where proguard files without newlines at the end of the file would get merged with the next file. Most of the time the next file started with a comment, which worked fine, but sometimes it was a syntax error. Bug: 72969557 Test: m Test: build on an internal tree that failed last time Change-Id: I66f13ae80ee0f96b456e526bfbfc2cdcf82c3f3a --- core/static_java_library.mk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/static_java_library.mk b/core/static_java_library.mk index c1478f10d..1dc0e7148 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -119,10 +119,17 @@ endif endif ifdef LOCAL_USE_AAPT2 -$(intermediates.COMMON)/export_proguard_flags: $(addprefix $(LOCAL_PATH)/,$(LOCAL_EXPORT_PROGUARD_FLAG_FILES)) +import_proguard_flag_files := $(strip $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\ + $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags)) +$(intermediates.COMMON)/export_proguard_flags: $(import_proguard_flag_files) $(addprefix $(LOCAL_PATH)/,$(LOCAL_EXPORT_PROGUARD_FLAG_FILES)) @echo "Export proguard flags: $@" rm -f $@ - cat $+ >$@ + touch $@ + for f in $+; do \ + echo -e "\n# including $$f" >>$@; \ + cat $$f >>$@; \ + done +import_proguard_flag_files := endif # add --non-constant-id to prevent inlining constants.