From 4df82b3e30794a3652a5dda773a74f486fec3325 Mon Sep 17 00:00:00 2001 From: Mihail Dumitrescu Date: Fri, 7 Feb 2014 15:18:59 +0000 Subject: [PATCH] Allow proguarding the main app and the test app in a single run. Bug: 12895101 Change-Id: I6804d73306a164d3e3ec0cab4743f9582b5ef2cf --- core/clear_vars.mk | 1 + core/definitions.mk | 3 ++- core/java.mk | 8 +++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index a8b7b287b9..9713b6e947 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -141,6 +141,7 @@ LOCAL_PREBUILT_MODULE_FILE:= LOCAL_POST_INSTALL_CMD:= LOCAL_DIST_BUNDLED_BINARIES:= LOCAL_HAL_STATIC_LIBRARIES:= +LOCAL_TEST_MODULE_TO_PROGUARD_WITH:= # Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to # iterate over thousands of entries every time. diff --git a/core/definitions.mk b/core/definitions.mk index e1eb9f12be..9a4a274652 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1884,7 +1884,8 @@ endif ########################################################### define transform-jar-to-proguard @echo Proguard: $@ -$(hide) $(PROGUARD) -injars $< -outjars $@ $(PRIVATE_PROGUARD_FLAGS) +$(hide) $(PROGUARD) -injars $< -outjars $@ $(PRIVATE_PROGUARD_FLAGS) \ + $(addprefix -injars , $(PRIVATE_EXTRA_INPUT_JAR)) endef ########################################################### diff --git a/core/java.mk b/core/java.mk index f237965a38..4f44770088 100644 --- a/core/java.mk +++ b/core/java.mk @@ -430,8 +430,14 @@ endif # LOCAL_PROGUARD_ENABLED is not nosystem proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES)) LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files)) +ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH +extra_input_jar := $(call intermediates-dir-for,APPS,$(LOCAL_TEST_MODULE_TO_PROGUARD_WITH),,COMMON)/classes.jar +else +extra_input_jar := +endif +$(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar) $(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(proguard_flags) $(LOCAL_PROGUARD_FLAGS) -$(full_classes_proguard_jar) : $(full_classes_jar) $(proguard_flag_files) | $(ACP) $(PROGUARD) +$(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(proguard_flag_files) | $(ACP) $(PROGUARD) $(call transform-jar-to-proguard) else # LOCAL_PROGUARD_ENABLED not defined