Fix nested properties in soong config structs

Fix recursing into nested properties when creating the structs for
affectable properties in soong config modules.

Fixes: 181156850
Test: Test_createAffectablePropertiesType
Change-Id: I4fb645d7e334977d0bbf192c3b43a7bba8289f49
This commit is contained in:
Colin Cross
2021-03-05 17:25:41 -08:00
parent f8dcf5ead2
commit 997f27aa03
2 changed files with 48 additions and 1 deletions

View File

@@ -235,6 +235,44 @@ func Test_createAffectablePropertiesType(t *testing.T) {
}{},
want: "",
},
{
name: "nested",
affectableProperties: []string{"multilib.lib32.cflags"},
factoryProps: struct {
Multilib struct {
Lib32 struct {
Cflags string
}
}
}{},
want: "*struct { Multilib struct { Lib32 struct { Cflags string } } }",
},
{
name: "complex",
affectableProperties: []string{
"cflags",
"multilib.lib32.cflags",
"multilib.lib32.ldflags",
"multilib.lib64.cflags",
"multilib.lib64.ldflags",
"zflags",
},
factoryProps: struct {
Cflags string
Multilib struct {
Lib32 struct {
Cflags string
Ldflags string
}
Lib64 struct {
Cflags string
Ldflags string
}
}
Zflags string
}{},
want: "*struct { Cflags string; Multilib struct { Lib32 struct { Cflags string; Ldflags string }; Lib64 struct { Cflags string; Ldflags string } }; Zflags string }",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {