Make the prefer property configurable
To replace soong config modules with selects.
Bug: 342006386
Test: m nothing --no-skip-soong-tests
Change-Id: I56080c9a1647a072836d4e4e50d6a5d2c1a69d28
diff --git a/android/prebuilt.go b/android/prebuilt.go
index 51b86a5..8856d26 100644
--- a/android/prebuilt.go
+++ b/android/prebuilt.go
@@ -61,7 +61,7 @@
type UserSuppliedPrebuiltProperties struct {
// When prefer is set to true the prebuilt will be used instead of any source module with
// a matching name.
- Prefer *bool `android:"arch_variant"`
+ Prefer proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
// When specified this names a Soong config variable that controls the prefer property.
//
@@ -148,11 +148,7 @@
}
func (p *Prebuilt) ForcePrefer() {
- p.properties.Prefer = proptools.BoolPtr(true)
-}
-
-func (p *Prebuilt) Prefer() bool {
- return proptools.Bool(p.properties.Prefer)
+ p.properties.Prefer = NewSimpleConfigurable(true)
}
// SingleSourcePathFromSupplier invokes the supplied supplier for the current module in the
@@ -707,7 +703,7 @@
}
// TODO: use p.Properties.Name and ctx.ModuleDir to override preference
- return Bool(p.properties.Prefer)
+ return p.properties.Prefer.GetOrDefault(ctx, false)
}
func (p *Prebuilt) SourceExists() bool {