Dedup path properties across property structs

Listing a property in multiple property structs would cause it to
add multiple dependencies with the same dependency tag, which would
trip the panic in getDirectDepInternal when calling
PathForModuleSrc.  Dedup the properties with the android:"path"
struct tag across all property structs.

Test: path_properties_test.go
Change-Id: Ib6c0e7789443d340ee7551721df0135c5ee64c0f
This commit is contained in:
Colin Cross
2019-07-15 13:35:21 -07:00
parent ae11318633
commit 527f3e5511
2 changed files with 21 additions and 8 deletions

View File

@@ -35,16 +35,17 @@ func pathDepsMutator(ctx BottomUpMutatorContext) {
props := m.base().generalProperties
var pathProperties []string
for _, ps := range props {
pathProperties := pathPropertiesForPropertyStruct(ctx, ps)
pathProperties = FirstUniqueStrings(pathProperties)
pathProperties = append(pathProperties, pathPropertiesForPropertyStruct(ctx, ps)...)
}
for _, s := range pathProperties {
if m, t := SrcIsModuleWithTag(s); m != "" {
ctx.AddDependency(ctx.Module(), sourceOrOutputDepTag(t), m)
}
pathProperties = FirstUniqueStrings(pathProperties)
for _, s := range pathProperties {
if m, t := SrcIsModuleWithTag(s); m != "" {
ctx.AddDependency(ctx.Module(), sourceOrOutputDepTag(t), m)
}
}
}