diff options
Diffstat (limited to 'java/base.go')
-rw-r--r-- | java/base.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/java/base.go b/java/base.go index b9e236cf0..056dbd528 100644 --- a/java/base.go +++ b/java/base.go @@ -1650,11 +1650,23 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath classesJar: implementationAndResourcesJar, jarName: jarName, } - dexOutputFile = j.dexer.compileDex(ctx, params) + if j.EnableProfileRewriting() { + profile := j.GetProfile() + if profile == "" || !j.GetProfileGuided() { + ctx.PropertyErrorf("enable_profile_rewriting", "Profile and Profile_guided must be set when enable_profile_rewriting is true") + } + params.artProfileInput = &profile + } + dexOutputFile, dexArtProfileOutput := j.dexer.compileDex(ctx, params) if ctx.Failed() { return } + // If r8/d8 provides a profile that matches the optimized dex, use that for dexpreopt. + if dexArtProfileOutput != nil { + j.dexpreopter.SetRewrittenProfile(*dexArtProfileOutput) + } + // merge dex jar with resources if necessary if j.resourceJar != nil { jars := android.Paths{dexOutputFile, j.resourceJar} |