Unconditionally generate hash-based proguard mapping files
Previously, this was restricted to targets that enable R8 full mode, but
that was really just a temporary carveout to avoid disrupting other
targets. Since then, R8 full mode has been enabled by default for all
app targets, and the hash-based mapping mechanism is further integrated
into various debugging and retracing pipelines.
As of now, there are are only a very small number of targets that have
enabled optimization/obfuscation and are still using R8 compat mode, so
the build-time impact of this change should be minimal, and there should
be no functional runtime side effects.
Bug: 297566172
Test: m framework-appsearch + inspect proguard mapping
Change-Id: I5dfea60f60dc37b8445c8fddba6a4eab0dc41d96
diff --git a/java/dex.go b/java/dex.go
index 5b8cf3d..c1d51c7 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -315,15 +315,14 @@
if BoolDefault(opt.Proguard_compatibility, true) {
r8Flags = append(r8Flags, "--force-proguard-compatibility")
- } else {
+ }
+
+ if Bool(opt.Optimize) || Bool(opt.Obfuscate) {
// TODO(b/213833843): Allow configuration of the prefix via a build variable.
var sourceFilePrefix = "go/retraceme "
var sourceFileTemplate = "\"" + sourceFilePrefix + "%MAP_ID\""
- // TODO(b/200967150): Also tag the source file in compat builds.
- if Bool(opt.Optimize) || Bool(opt.Obfuscate) {
- r8Flags = append(r8Flags, "--map-id-template", "%MAP_HASH")
- r8Flags = append(r8Flags, "--source-file-template", sourceFileTemplate)
- }
+ r8Flags = append(r8Flags, "--map-id-template", "%MAP_HASH")
+ r8Flags = append(r8Flags, "--source-file-template", sourceFileTemplate)
}
// TODO(ccross): Don't shrink app instrumentation tests by default.