Skip to content

Commit b06bce2

Browse files
committed
Dependencies: Fix deduplication issue when parsing dependency trace v1
1 parent 6b6685c commit b06bce2

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
@@ -543,15 +543,16 @@ public final class ClangCompileTaskAction: TaskAction, BuildValueValidatingTaskA
543543
}
544544
return file.dirname.isEmpty || file.dirname.isRoot ? nil : findFrameworkName(file.dirname)
545545
}
546-
var moduleImports: [DependencyValidationInfo.Import] = []
546+
var moduleImportsByName = [String: Set<SWBUtil.Diagnostic.Location>]()
547547
var headerIncludes: [DependencyValidationInfo.Include] = []
548548
for (file, includeLocations) in files {
549549
if let frameworkName = findFrameworkName(file) {
550-
moduleImports.append(DependencyValidationInfo.Import(dependency: ModuleDependency(name: frameworkName, accessLevel: .Private, optional: false), importLocations: Array(includeLocations)))
550+
moduleImportsByName[frameworkName, default: []].formUnion(includeLocations)
551551
} else {
552552
headerIncludes.append(DependencyValidationInfo.Include(path: file, includeLocations: Array(includeLocations)))
553553
}
554554
}
555+
let moduleImports = moduleImportsByName.map { name, locations in DependencyValidationInfo.Import(dependency: ModuleDependency(name: name, accessLevel: .Private, optional: false), importLocations: Array(locations)) }
555556
return (moduleImports, headerIncludes)
556557
}
557558
}

0 commit comments

Comments
 (0)