Merge "[cc_fuzz] Collect shared deps by name, not by module."

This commit is contained in:
Treehugger Robot
2020-04-30 22:26:22 +00:00
committed by Gerrit Code Review

View File

@@ -126,7 +126,7 @@ func (fuzz *fuzzBinary) linkerFlags(ctx ModuleContext, flags Flags) Flags {
func collectAllSharedDependencies(ctx android.SingletonContext, module android.Module) android.Paths { func collectAllSharedDependencies(ctx android.SingletonContext, module android.Module) android.Paths {
var fringe []android.Module var fringe []android.Module
seen := make(map[android.Module]bool) seen := make(map[string]bool)
// Enumerate the first level of dependencies, as we discard all non-library // Enumerate the first level of dependencies, as we discard all non-library
// modules in the BFS loop below. // modules in the BFS loop below.
@@ -140,15 +140,15 @@ func collectAllSharedDependencies(ctx android.SingletonContext, module android.M
for i := 0; i < len(fringe); i++ { for i := 0; i < len(fringe); i++ {
module := fringe[i] module := fringe[i]
if seen[module] { if seen[module.Name()] {
continue continue
} }
seen[module] = true seen[module.Name()] = true
ccModule := module.(*Module) ccModule := module.(*Module)
sharedLibraries = append(sharedLibraries, ccModule.UnstrippedOutputFile()) sharedLibraries = append(sharedLibraries, ccModule.UnstrippedOutputFile())
ctx.VisitDirectDeps(module, func(dep android.Module) { ctx.VisitDirectDeps(module, func(dep android.Module) {
if isValidSharedDependency(dep) && !seen[dep] { if isValidSharedDependency(dep) && !seen[dep.Name()] {
fringe = append(fringe, dep) fringe = append(fringe, dep)
} }
}) })
@@ -255,13 +255,13 @@ func (fuzz *fuzzBinary) install(ctx ModuleContext, file android.Path) {
} }
// Grab the list of required shared libraries. // Grab the list of required shared libraries.
seen := make(map[android.Module]bool) seen := make(map[string]bool)
var sharedLibraries android.Paths var sharedLibraries android.Paths
ctx.WalkDeps(func(child, parent android.Module) bool { ctx.WalkDeps(func(child, parent android.Module) bool {
if seen[child] { if seen[child.Name()] {
return false return false
} }
seen[child] = true seen[child.Name()] = true
if isValidSharedDependency(child) { if isValidSharedDependency(child) {
sharedLibraries = append(sharedLibraries, child.(*Module).UnstrippedOutputFile()) sharedLibraries = append(sharedLibraries, child.(*Module).UnstrippedOutputFile())