diff options
author | 2024-11-14 23:10:09 +0000 | |
---|---|---|
committer | 2024-11-14 23:13:53 +0000 | |
commit | 91d0beea4f1401ca2dba53fd10072e51b69c7af4 (patch) | |
tree | e7524ddfbdad93cd1ae7e091cac63afc31205782 /java | |
parent | 29520dbdff69b890b0908d3fa764107e12878ff7 (diff) |
Disable source map id usage in eng builds
Injecting the source map details into stack frames for eng builds
adds unnecessary noise, as the `--debug` configuration implicitly
disables optimization/obfuscation.
Bug: 377957431
Test: lunch eng target + m + ensure no --source-file-template in R8 args
Change-Id: I28235f148d311d3422c5d0f9dda178d5984e6e30
Diffstat (limited to 'java')
-rw-r--r-- | java/dex.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/java/dex.go b/java/dex.go index 1f71aee1a..516a91709 100644 --- a/java/dex.go +++ b/java/dex.go @@ -295,7 +295,7 @@ func (d *dexer) d8Flags(ctx android.ModuleContext, dexParams *compileDexParams) return d8Flags, d8Deps, artProfileOutput } -func (d *dexer) r8Flags(ctx android.ModuleContext, dexParams *compileDexParams) (r8Flags []string, r8Deps android.Paths, artProfileOutput *android.OutputPath) { +func (d *dexer) r8Flags(ctx android.ModuleContext, dexParams *compileDexParams, debugMode bool) (r8Flags []string, r8Deps android.Paths, artProfileOutput *android.OutputPath) { flags := dexParams.flags opt := d.dexProperties.Optimize @@ -363,7 +363,9 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, dexParams *compileDexParams) r8Flags = append(r8Flags, "--force-proguard-compatibility") } - if Bool(opt.Optimize) || Bool(opt.Obfuscate) { + // Avoid unnecessary stack frame noise by only injecting source map ids for non-debug + // optimized or obfuscated targets. + if (Bool(opt.Optimize) || Bool(opt.Obfuscate)) && !debugMode { // TODO(b/213833843): Allow configuration of the prefix via a build variable. var sourceFilePrefix = "go/retraceme " var sourceFileTemplate = "\"" + sourceFilePrefix + "%MAP_ID\"" @@ -482,7 +484,8 @@ func (d *dexer) compileDex(ctx android.ModuleContext, dexParams *compileDexParam proguardUsageZip, proguardConfiguration, } - r8Flags, r8Deps, r8ArtProfileOutputPath := d.r8Flags(ctx, dexParams) + debugMode := android.InList("--debug", commonFlags) + r8Flags, r8Deps, r8ArtProfileOutputPath := d.r8Flags(ctx, dexParams, debugMode) rule := r8 args := map[string]string{ "r8Flags": strings.Join(append(commonFlags, r8Flags...), " "), |