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
diff --git a/android/soongconfig/modules_test.go b/android/soongconfig/modules_test.go
index b824c78..48cdfe7 100644
--- a/android/soongconfig/modules_test.go
+++ b/android/soongconfig/modules_test.go
@@ -235,6 +235,44 @@
}{},
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) {