summaryrefslogtreecommitdiff
path: root/java/base.go
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-05-29 02:33:11 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2024-05-29 02:33:11 +0000
commitb18a30edde56f49e6c6d0257c91f104f9076efcb (patch)
treefae217b40fcf37b78050657b01f6735a6edbcb66 /java/base.go
parent8f3a8099f8191042d81479d9d04a398039912ec4 (diff)
parent8723705fadb0af4a670e6537014061eea7297caa (diff)
Merge "Use r8/d8 optimized profile for dexpreopt" into main am: 8723705fad
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3095860 Change-Id: Ifc3c21a58ff94bf7ece2a23b1f66c35eb7e51872 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'java/base.go')
-rw-r--r--java/base.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/java/base.go b/java/base.go
index 5c637b500..403977557 100644
--- a/java/base.go
+++ b/java/base.go
@@ -1655,11 +1655,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}