Pass desired size proptools.FilterPropertyStructSharded
proptools.FilterPropertyStructSharded now takes a desired max size
of the name.
Fixes: 146234651
Test: all soong tests
Change-Id: Ifa10039e5f55a5d0f4a35172983d43f33af88e93
diff --git a/android/arch.go b/android/arch.go
index 91864f1..62c7db7 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -938,7 +938,14 @@
// returns lists of reflect.Types that contains the arch-variant properties inside structs for each
// arch, multilib and target property.
func createArchPropTypeDesc(props reflect.Type) []archPropTypeDesc {
- propShards, _ := proptools.FilterPropertyStructSharded(props, filterArchStruct)
+ // Each property struct shard will be nested many times under the runtime generated arch struct,
+ // which can hit the limit of 64kB for the name of runtime generated structs. They are nested
+ // 97 times now, which may grow in the future, plus there is some overhead for the containing
+ // type. This number may need to be reduced if too many are added, but reducing it too far
+ // could cause problems if a single deeply nested property no longer fits in the name.
+ const maxArchTypeNameSize = 500
+
+ propShards, _ := proptools.FilterPropertyStructSharded(props, maxArchTypeNameSize, filterArchStruct)
if len(propShards) == 0 {
return nil
}