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
This commit is contained in:
Jared Duke 2023-09-15 17:16:36 +00:00
parent eb67c30dae
commit b832fbb643

View file

@ -315,15 +315,14 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, flags javaBuilderFlags) (r8Fl
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.