Support unpacking a variable to a configurable property am: 28357db9d0
am: ea224ecf22
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/3040813 Change-Id: Iaf13baa636be6a7651bcf1ee86de31b20ef07974 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
91dce455c0
2 changed files with 39 additions and 0 deletions
|
@ -419,6 +419,9 @@ func (ctx *unpackContext) unpackToConfigurable(propertyName string, property *pa
|
|||
case *parser.Operator:
|
||||
property.Value = v.Value.Eval()
|
||||
return ctx.unpackToConfigurable(propertyName, property, configurableType, configuredType)
|
||||
case *parser.Variable:
|
||||
property.Value = v.Value.Eval()
|
||||
return ctx.unpackToConfigurable(propertyName, property, configurableType, configuredType)
|
||||
case *parser.Select:
|
||||
resultPtr := reflect.New(configurableType)
|
||||
result := resultPtr.Elem()
|
||||
|
|
|
@ -924,6 +924,42 @@ var validUnpackTestCases = []struct {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Unpack variable to configurable property",
|
||||
input: `
|
||||
my_string_variable = "asdf"
|
||||
my_bool_variable = true
|
||||
m {
|
||||
foo: my_string_variable,
|
||||
bar: my_bool_variable,
|
||||
}
|
||||
`,
|
||||
output: []interface{}{
|
||||
&struct {
|
||||
Foo Configurable[string]
|
||||
Bar Configurable[bool]
|
||||
}{
|
||||
Foo: Configurable[string]{
|
||||
propertyName: "foo",
|
||||
cases: []configurableCase[string]{
|
||||
{
|
||||
value: StringPtr("asdf"),
|
||||
},
|
||||
},
|
||||
appendWrapper: &appendWrapper[string]{},
|
||||
},
|
||||
Bar: Configurable[bool]{
|
||||
propertyName: "bar",
|
||||
cases: []configurableCase[bool]{
|
||||
{
|
||||
value: BoolPtr(true),
|
||||
},
|
||||
},
|
||||
appendWrapper: &appendWrapper[bool]{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func TestUnpackProperties(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue