Added support for using R8 instead of Proguard + dx
With this change building with USE_R8=true will run R8 instead of Proguard + dx
for all targets that have LOCAL_PROGUARD_ENABLED set. R8 (through the
compatproguard wrapper) will use the same options as Proguard for now.
Additional Proguard configurations for R8 can be added using LOCAL_R8_FLAG_FILES
on individual targets. This makes it possible to make configuration updates
without touching the Proguard + dx configuration
Test: m -j
Test: m -j USE_D8=true USE_R8=true
Test: m -j USE_D8=true USE_R8=false
Test: m -j USE_D8=true
Change-Id: I78e8a0fd17cc5cefedccffe95b93c94a60a727f1
diff --git a/core/definitions.mk b/core/definitions.mk
index 99d048b..af4b695 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2788,6 +2788,19 @@
endef
###########################################################
+## Commands to call R8
+###########################################################
+define transform-jar-to-dex-r8
+@echo R8: $@
+$(hide) $(R8) -injars '$<$(PRIVATE_PROGUARD_INJAR_FILTERS)' \
+ --min-api $(PRIVATE_MIN_SDK_VERSION) \
+ --force-proguard-compatibility --output $(subst classes.dex,,$@) \
+ $(PRIVATE_PROGUARD_FLAGS) \
+ $(addprefix -injars , $(PRIVATE_EXTRA_INPUT_JAR)) \
+ $(PRIVATE_DX_FLAGS)
+endef
+
+###########################################################
## Stuff source generated from one-off tools
###########################################################