Merge "Prevent evaluating configurable properties before the defaults mutator" into main
This commit is contained in:
@@ -2215,6 +2215,7 @@ func (m *ModuleBase) IsNativeBridgeSupported() bool {
|
|||||||
type ConfigurableEvaluatorContext interface {
|
type ConfigurableEvaluatorContext interface {
|
||||||
Config() Config
|
Config() Config
|
||||||
OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{})
|
OtherModulePropertyErrorf(module Module, property string, fmt string, args ...interface{})
|
||||||
|
HasMutatorFinished(mutatorName string) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type configurationEvalutor struct {
|
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 {
|
func (e configurationEvalutor) EvaluateConfiguration(condition proptools.ConfigurableCondition, property string) proptools.ConfigurableValue {
|
||||||
ctx := e.ctx
|
ctx := e.ctx
|
||||||
m := e.m
|
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() {
|
switch condition.FunctionName() {
|
||||||
case "release_flag":
|
case "release_flag":
|
||||||
if condition.NumArgs() != 1 {
|
if condition.NumArgs() != 1 {
|
||||||
|
@@ -118,6 +118,7 @@ func runPackagingTest(t *testing.T, config testConfig, bp string, expected []str
|
|||||||
}
|
}
|
||||||
|
|
||||||
result := GroupFixturePreparers(
|
result := GroupFixturePreparers(
|
||||||
|
PrepareForTestWithDefaults,
|
||||||
PrepareForTestWithArchMutator,
|
PrepareForTestWithArchMutator,
|
||||||
FixtureRegisterWithContext(func(ctx RegistrationContext) {
|
FixtureRegisterWithContext(func(ctx RegistrationContext) {
|
||||||
ctx.RegisterModuleType("component", componentTestModuleFactory)
|
ctx.RegisterModuleType("component", componentTestModuleFactory)
|
||||||
|
Reference in New Issue
Block a user