Support `use_d8` partial compile flag
Make `use_d8` an opt-out flag (when SOONG_PARTIAL_COMPILE=true).
Bug: b/374975543
Test: manual, TH
Change-Id: Iaef4bb5243957812783c5dbc79a5bf27e1096166
diff --git a/android/config.go b/android/config.go
index acaad60..3867c11 100644
--- a/android/config.go
+++ b/android/config.go
@@ -394,6 +394,17 @@
// Add others as needed.
}
+// These are the flags when `SOONG_PARTIAL_COMPILE` is empty or not set.
+var defaultPartialCompileFlags = partialCompileFlags{
+ Enabled: false,
+}
+
+// These are the flags when `SOONG_PARTIAL_COMPILE=true`.
+var enabledPartialCompileFlags = partialCompileFlags{
+ Enabled: true,
+ Use_d8: true,
+}
+
type deviceConfig struct {
config *config
OncePer
@@ -427,11 +438,6 @@
// To add a new feature to the list, add the field in the struct
// `partialCompileFlags` above, and then add the name of the field in the
// switch statement below.
-var defaultPartialCompileFlags = partialCompileFlags{
- // Set any opt-out flags here. Opt-in flags are off by default.
- Enabled: false,
-}
-
func (c *config) parsePartialCompileFlags(isEngBuild bool) (partialCompileFlags, error) {
if !isEngBuild {
return partialCompileFlags{}, nil
@@ -472,8 +478,7 @@
}
switch tok {
case "true":
- ret = defaultPartialCompileFlags
- ret.Enabled = true
+ ret = enabledPartialCompileFlags
case "false":
// Set everything to false.
ret = partialCompileFlags{}
diff --git a/android/config_test.go b/android/config_test.go
index 4bdf05f..3d86860 100644
--- a/android/config_test.go
+++ b/android/config_test.go
@@ -239,10 +239,10 @@
}{
{"", true, defaultPartialCompileFlags},
{"false", true, partialCompileFlags{}},
- {"true", true, defaultPartialCompileFlags.updateEnabled(true)},
+ {"true", true, enabledPartialCompileFlags},
{"true", false, partialCompileFlags{}},
- {"true,use_d8", true, defaultPartialCompileFlags.updateEnabled(true).updateUseD8(true)},
- {"true,-use_d8", true, defaultPartialCompileFlags.updateEnabled(true).updateUseD8(false)},
+ {"true,use_d8", true, enabledPartialCompileFlags.updateUseD8(true)},
+ {"true,-use_d8", true, enabledPartialCompileFlags.updateUseD8(false)},
{"use_d8,false", true, partialCompileFlags{}},
{"false,+use_d8", true, partialCompileFlags{}.updateUseD8(true)},
}