Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,9 @@ extension IncrementalCompilationState {
guard job.kind == .compile else {
return Set<TypedVirtualPath>()
}
return Set(
job.primaryInputs.flatMap { input in
collectInputsInvalidated(byCompiling: input)
}
)
return job.primaryInputs.reduce(into: Set()) { invalidatedInputs, primaryInput in
invalidatedInputs.formUnion(collectInputsInvalidated(byCompiling: primaryInput))
}
.subtracting(job.primaryInputs) // have already compiled these
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ extension ModuleDependencyGraph {
// MARK: - Getting a graph read from priors ready to use
extension ModuleDependencyGraph {
func collectNodesInvalidatedByChangedOrAddedExternals() -> Set<Node> {
let invalidatedNodes = fingerprintedExternalDependencies.lazy.flatMap {
self.collectNodesInvalidatedByProcessing(fingerprintedExternalDependency: $0,
includeAddedExternals: true)
fingerprintedExternalDependencies.reduce(into: Set()) { invalidatedNodes, fed in
invalidatedNodes.formUnion (
self.collectNodesInvalidatedByProcessing(fingerprintedExternalDependency: fed,
includeAddedExternals: true))
}
return Set(invalidatedNodes)
}
}

// MARK: - Scheduling the first wave
extension ModuleDependencyGraph {
/// Find all the sources that depend on `sourceFile`. For some source files, these will be
Expand Down Expand Up @@ -179,11 +180,13 @@ extension ModuleDependencyGraph {
in: self,
diagnosticEngine: info.diagnosticEngine)
.tracedUses
let invalidatedSources = Set(
affectedNodes.compactMap {
$0.dependencySource.flatMap {$0.typedFile.type == .swiftDeps ? $0 : nil}
})
return invalidatedSources
return affectedNodes.reduce(into: Set()) {
invalidatedSources, affectedNode in
if let source = affectedNode.dependencySource,
source.typedFile.type == .swiftDeps {
invalidatedSources.insert(source)
}
}
}

/// Given an external dependency & its fingerprint, find any nodes directly using that dependency.
Expand Down Expand Up @@ -248,10 +251,10 @@ extension ModuleDependencyGraph {
func collectInputsUsingTransitivelyInvalidated(
nodes invalidatedNodes: Set<Node>
) -> Set<TypedVirtualPath> {
let invalidatedInputs =
collectSwiftDepsUsingTransitivelyInvalidated(nodes: invalidatedNodes).lazy
.map(getInput(for:))
return Set(invalidatedInputs)
collectSwiftDepsUsingTransitivelyInvalidated(nodes: invalidatedNodes)
.reduce(into: Set()) { invalidatedInputs, invalidatedSwiftDeps in
invalidatedInputs.insert(getInput(for: invalidatedSwiftDeps))
}
}
}

Expand Down