summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-03-25 19:42:59 -0700
committer Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-03-25 19:42:59 -0700
commita66eff7b444687714135a89e57a6dd1c60bf0064 (patch)
tree67a51170976ac4df24f809828f70fc1c63d1c513
parentfc5e8dc9c38db6628ed1d9172161187da74b066f (diff)
parent1abd20d2e232f1a19921aecfb713f28572def8bd (diff)
Merge cherrypicks of ['android-review.googlesource.com/3558150'] into 25Q2-release.
Change-Id: I65d6e3a77496c6720853bfe52db9dbc9ee5199fd
-rw-r--r--java/dex.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/java/dex.go b/java/dex.go
index dd6467546..e3058e9bf 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -42,6 +42,10 @@ type DexProperties struct {
// True if the module containing this has it set by default.
EnabledByDefault bool `blueprint:"mutated"`
+ // If true, then `d8` will be used on eng builds instead of `r8`, even though
+ // optimize.enabled is true.
+ D8_on_eng *bool
+
// Whether to allow that library classes inherit from program classes.
// Defaults to false.
Ignore_library_extends_program *bool
@@ -162,7 +166,12 @@ type dexer struct {
}
func (d *dexer) effectiveOptimizeEnabled(ctx android.EarlyModuleContext) bool {
- return BoolDefault(d.dexProperties.Optimize.Enabled, d.dexProperties.Optimize.EnabledByDefault && !ctx.Config().Eng())
+ // For eng builds, if Optimize.D8_on_eng is true, then disable optimization.
+ if ctx.Config().Eng() && proptools.Bool(d.dexProperties.Optimize.D8_on_eng) {
+ return false
+ }
+ // Otherwise, use the legacy logic of a default value which can be explicitly overridden by the module.
+ return BoolDefault(d.dexProperties.Optimize.Enabled, d.dexProperties.Optimize.EnabledByDefault)
}
func (d *DexProperties) resourceShrinkingEnabled(ctx android.ModuleContext) bool {