From 61d14fa7dd2278f7748c4b551b00ec685eddcb79 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Thu, 20 Feb 2025 13:49:07 -0800 Subject: Avoid duplicate rules for profile.prof.txt files Bug: b/374975543 Test: manual, TH Change-Id: I3bdc4df420456c476c143a5249fb130aa0b2c42e --- java/dex.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'java/dex.go') diff --git a/java/dex.go b/java/dex.go index c9d3f376d..f121aeaba 100644 --- a/java/dex.go +++ b/java/dex.go @@ -583,7 +583,6 @@ func (d *dexer) compileDex(ctx android.ModuleContext, dexParams *compileDexParam var description string var artProfileOutputPath *android.OutputPath var implicitOutputs android.WritablePaths - var flags []string var deps android.Paths args := map[string]string{ "zipFlags": zipFlags, @@ -610,18 +609,13 @@ func (d *dexer) compileDex(ctx android.ModuleContext, dexParams *compileDexParam description = "r8" debugMode := android.InList("--debug", commonFlags) r8Flags, r8Deps, r8ArtProfileOutputPath := d.r8Flags(ctx, dexParams, debugMode) - flags = append(flags, r8Flags...) deps = append(deps, r8Deps...) args["r8Flags"] = strings.Join(append(commonFlags, r8Flags...), " ") if r8ArtProfileOutputPath != nil { artProfileOutputPath = r8ArtProfileOutputPath - implicitOutputs = append( - implicitOutputs, - artProfileOutputPath, - ) // Add the implicit r8 Art profile output to args so that r8RE knows // about this implicit output - args["outR8ArtProfile"] = artProfileOutputPath.String() + args["outR8ArtProfile"] = r8ArtProfileOutputPath.String() } args["outDict"] = proguardDictionary.String() args["outConfig"] = proguardConfiguration.String() @@ -642,16 +636,11 @@ func (d *dexer) compileDex(ctx android.ModuleContext, dexParams *compileDexParam if useD8 { description = "d8" d8Flags, d8Deps, d8ArtProfileOutputPath := d.d8Flags(ctx, dexParams) - flags = append(flags, d8Flags...) deps = append(deps, d8Deps...) deps = append(deps, commonDeps...) args["d8Flags"] = strings.Join(append(commonFlags, d8Flags...), " ") if d8ArtProfileOutputPath != nil { artProfileOutputPath = d8ArtProfileOutputPath - implicitOutputs = append( - implicitOutputs, - artProfileOutputPath, - ) } // If we are generating both d8 and r8, only use RBE when both are enabled. switch { @@ -667,6 +656,12 @@ func (d *dexer) compileDex(ctx android.ModuleContext, dexParams *compileDexParam rule = d8 } } + if artProfileOutputPath != nil { + implicitOutputs = append( + implicitOutputs, + artProfileOutputPath, + ) + } ctx.Build(pctx, android.BuildParams{ Rule: rule, Description: description, -- cgit v1.2.3-59-g8ed1b