Merge "Use r8/d8 optimized profile for dexpreopt" into main am: 8723705fad am: b18a30edde

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3095860

Change-Id: I67a2cc8d84fd930a20f6113a302f604eb53fa3f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2024-05-29 22:55:41 +00:00
committed by Automerger Merge Worker
5 changed files with 156 additions and 31 deletions

View File

@@ -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}