Capture list of unused methods when shrinking in R8
Use the -printusage flag in R8 to output a list of the unused
methods. Some of the files can be large (2MB for DocumentsUI,
87MB for all of AOSP), so immediately zip them and remove the
originals. The zipped files will be merged and disted.
Bug: 151857441
Test: m TARGET_BUILD_APPS=DocumentsUI dist
Change-Id: I780e84e80eba7fe4d4fa15fec0f461890afd900b
Merged-In: I780e84e80eba7fe4d4fa15fec0f461890afd900b
(cherry picked from commit cb6143a142a3a7985d18ad346a6c21314b90cf87)
diff --git a/java/androidmk.go b/java/androidmk.go
index ae257d7..a159b77 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -130,6 +130,9 @@
if library.proguardDictionary != nil {
entries.SetPath("LOCAL_SOONG_PROGUARD_DICT", library.proguardDictionary)
}
+ if library.proguardUsageZip.Valid() {
+ entries.SetPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", library.proguardUsageZip.Path())
+ }
entries.SetString("LOCAL_MODULE_STEM", library.Stem())
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", library.linter.reports)
@@ -335,6 +338,9 @@
if app.proguardDictionary != nil {
entries.SetPath("LOCAL_SOONG_PROGUARD_DICT", app.proguardDictionary)
}
+ if app.proguardUsageZip.Valid() {
+ entries.SetPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", app.proguardUsageZip.Path())
+ }
if app.Name() == "framework-res" {
entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")