Don't evaluate the enabled property in a defaultable hook

So that we can decide the configuration after defaults are evaluated.
Instead, pass the enabled property on to submodules.

Bug: 361816274
Test: m nothing --no-skip-soong-tests
Change-Id: I853d557ed022f7434287cea0a2a19e684b59e145
This commit is contained in:
Cole Faust
2024-09-12 11:51:04 -07:00
parent 6556d043bd
commit 8eeae4bbbe
2 changed files with 19 additions and 5 deletions

View File

@@ -1346,6 +1346,14 @@ func (m *ModuleBase) Enabled(ctx ConfigurableEvaluatorContext) bool {
return m.commonProperties.Enabled.GetOrDefault(m.ConfigurableEvaluator(ctx), !m.Os().DefaultDisabled)
}
// Returns a copy of the enabled property, useful for passing it on to sub-modules
func (m *ModuleBase) EnabledProperty() proptools.Configurable[bool] {
if m.commonProperties.ForcedDisabled {
return proptools.NewSimpleConfigurable(false)
}
return m.commonProperties.Enabled.Clone()
}
func (m *ModuleBase) Disable() {
m.commonProperties.ForcedDisabled = true
}