Skip to content

Commit 6a44f6a

Browse files
sina-mahdavibob-wilson
authored andcommitted
Dependencies: Fix deduplication issue when parsing dependency trace v1
1 parent c5f62f1 commit 6a44f6a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/SWBTaskExecution/TaskActions/ClangCompileTaskAction.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,16 @@ public final class ClangCompileTaskAction: TaskAction, BuildValueValidatingTaskA
559559
}
560560
return file.dirname.isEmpty || file.dirname.isRoot ? nil : findFrameworkName(file.dirname)
561561
}
562-
var moduleImports: [DependencyValidationInfo.Import] = []
562+
var moduleImportsByName = [String: Set<SWBUtil.Diagnostic.Location>]()
563563
var headerIncludes: [DependencyValidationInfo.Include] = []
564564
for (file, includeLocations) in files {
565565
if let frameworkName = findFrameworkName(file) {
566-
moduleImports.append(DependencyValidationInfo.Import(dependency: ModuleDependency(name: frameworkName, accessLevel: .Private, optional: false), importLocations: Array(includeLocations)))
566+
moduleImportsByName[frameworkName, default: []].formUnion(includeLocations)
567567
} else {
568568
headerIncludes.append(DependencyValidationInfo.Include(path: file, includeLocations: Array(includeLocations)))
569569
}
570570
}
571+
let moduleImports = moduleImportsByName.map { name, locations in DependencyValidationInfo.Import(dependency: ModuleDependency(name: name, accessLevel: .Private, optional: false), importLocations: Array(locations)) }
571572
return (moduleImports, headerIncludes)
572573
}
573574
}

0 commit comments

Comments
 (0)