diff options
author | 2024-09-13 13:37:59 -0700 | |
---|---|---|
committer | 2024-09-13 13:37:59 -0700 | |
commit | d706709bf07e4a37093917c29e68151a0b14e441 (patch) | |
tree | 1e548a5b6159cb1ced4613abc2cd93382ca87928 /android/module.go | |
parent | c2ea958b3d4474d203d2937a02b265a39f77c8e8 (diff) |
Prevent evaluating configurable properties before the defaults mutator
So that we can change the configuration after the defaults mutator
has run.
Bug: 361816274
Test: Presubmits
Change-Id: I550088b2555d275a86b5dd4d57e85a9ece859233
Diffstat (limited to 'android/module.go')
-rw-r--r-- | android/module.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/android/module.go b/android/module.go index 491c295fb..dd83d6407 100644 --- a/android/module.go +++ b/android/module.go @@ -2215,6 +2215,7 @@ func (m *ModuleBase) IsNativeBridgeSupported() bool { type ConfigurableEvaluatorContext interface { Config() Config OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{}) + HasMutatorFinished(mutatorName string) bool } type configurationEvalutor struct { @@ -2236,6 +2237,12 @@ func (e configurationEvalutor) PropertyErrorf(property string, fmt string, args func (e configurationEvalutor) EvaluateConfiguration(condition proptools.ConfigurableCondition, property string) proptools.ConfigurableValue { ctx := e.ctx m := e.m + + if !ctx.HasMutatorFinished("defaults") { + ctx.OtherModulePropertyErrorf(m, property, "Cannot evaluate configurable property before the defaults mutator has run") + return proptools.ConfigurableValueUndefined() + } + switch condition.FunctionName() { case "release_flag": if condition.NumArgs() != 1 { |