Merge "Remove more duplicated flags and dependencies"
This commit is contained in:
@@ -283,6 +283,23 @@ func (p Paths) Strings() []string {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FirstUniqueElements returns all unique elements of a slice, keeping the first copy of each
|
||||||
|
// modifies the slice contents in place, and returns a subslice of the original slice
|
||||||
|
func FirstUniquePaths(list Paths) Paths {
|
||||||
|
k := 0
|
||||||
|
outer:
|
||||||
|
for i := 0; i < len(list); i++ {
|
||||||
|
for j := 0; j < k; j++ {
|
||||||
|
if list[i] == list[j] {
|
||||||
|
continue outer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list[k] = list[i]
|
||||||
|
k++
|
||||||
|
}
|
||||||
|
return list[:k]
|
||||||
|
}
|
||||||
|
|
||||||
// WritablePaths is a slice of WritablePaths, used for multiple outputs.
|
// WritablePaths is a slice of WritablePaths, used for multiple outputs.
|
||||||
type WritablePaths []WritablePath
|
type WritablePaths []WritablePath
|
||||||
|
|
||||||
|
7
cc/cc.go
7
cc/cc.go
@@ -1138,6 +1138,13 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
|
|
||||||
// Dedup exported flags from dependencies
|
// Dedup exported flags from dependencies
|
||||||
depPaths.Flags = firstUniqueElements(depPaths.Flags)
|
depPaths.Flags = firstUniqueElements(depPaths.Flags)
|
||||||
|
depPaths.GeneratedHeaders = android.FirstUniquePaths(depPaths.GeneratedHeaders)
|
||||||
|
depPaths.ReexportedFlags = firstUniqueElements(depPaths.ReexportedFlags)
|
||||||
|
depPaths.ReexportedFlagsDeps = android.FirstUniquePaths(depPaths.ReexportedFlagsDeps)
|
||||||
|
|
||||||
|
if c.sabi != nil {
|
||||||
|
c.sabi.Properties.ReexportedIncludeFlags = firstUniqueElements(c.sabi.Properties.ReexportedIncludeFlags)
|
||||||
|
}
|
||||||
|
|
||||||
return depPaths
|
return depPaths
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user