summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Renouf <mrenouf@google.com>2014-09-09 20:08:46 -0400
committerMark Renouf <mrenouf@google.com>2014-09-09 20:42:48 -0400
commit99332f11c5cdf1e58eb056c019d3ca8b1e3f034a (patch)
tree9cb354ad0dd03770452d1a9847c691f9207f927f
parent4f3d31479d5e4e8d35e60de628417cb820d69f5e (diff)
downloadbuild-99332f11c5cdf1e58eb056c019d3ca8b1e3f034a.zip
build-99332f11c5cdf1e58eb056c019d3ca8b1e3f034a.tar.gz
build-99332f11c5cdf1e58eb056c019d3ca8b1e3f034a.tar.bz2
Allow for opt-in of proguard shrinking of tests with new flag
By adding 'shrinktests' to LOCAL_PROGUARD_ENABLED, the -dontshrink flag will be omitted from the resulting proguard config allowing tests to have unnecessary classes removed before dexxing. Clockwork is running into 64k method limits on some tests which depend on GmsCore. On 4.4W (klp-modular-dev) we don't have the option for multi-dex so proguard is the only solution here. This change leaves the default behavior unchanged. Shrinking is still disabled for tests by default unless the 'shrinktests' flag is set in the Makefile. Change-Id: Ib586ae9e7f617072b41e95742559bf7c8a6a6ce1
-rw-r--r--core/java.mk5
-rw-r--r--core/proguard_tests.flags3
2 files changed, 6 insertions, 2 deletions
diff --git a/core/java.mk b/core/java.mk
index 8863ac2..79be181 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -378,7 +378,7 @@ $(full_classes_jar): $(full_classes_emma_jar) | $(ACP)
# Run proguard if necessary, otherwise just copy the file.
ifdef LOCAL_PROGUARD_ENABLED
-ifneq ($(filter-out full custom nosystem obfuscation optimization,$(LOCAL_PROGUARD_ENABLED)),)
+ifneq ($(filter-out full custom nosystem obfuscation optimization shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
$(warning while processing: $(LOCAL_MODULE))
$(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
endif
@@ -395,6 +395,9 @@ endif
# If this is a test package, add proguard keep flags for tests.
ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
proguard_flags += -include $(BUILD_SYSTEM)/proguard_tests.flags
+ifeq ($(filter shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
+proguard_flags += -dontshrink # don't shrink tests by default
+endif # shrinktests
endif # test package
ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
# By default no obfuscation
diff --git a/core/proguard_tests.flags b/core/proguard_tests.flags
index 4481a1b..1f840bc 100644
--- a/core/proguard_tests.flags
+++ b/core/proguard_tests.flags
@@ -1,5 +1,6 @@
# Keep everything for tests
--dontshrink
+# This flag has been moved to the makefiles and is set for tests by default.
+#-dontshrink
# But we may want to obfuscate if the main app gets obfuscated.
# This flag has been moved to the makefiles.