Skip to content

Commit a7fb1b8

Browse files
author
David Ungar
committed
fixup after rebasing
1 parent 25442c8 commit a7fb1b8

File tree

3 files changed

+36
-39
lines changed

3 files changed

+36
-39
lines changed

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraph.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,8 @@ extension ModuleDependencyGraph {
139139
}
140140

141141
public func integrate(sourceGraph: SourceFileDependencyGraph) -> Set<Node>? {
142-
let results = Integrator.integrateAndCollectExternalDepNodes(
143-
from: sourceGraph,
144-
into: self,
145-
isCrossModuleIncrementalBuildEnabled: isCrossModuleIncrementalBuildEnabled
146-
)
142+
let results = Integrator.integrateAndCollectExternalDepNodes(from: sourceGraph,
143+
into: self)
147144
guard let externallyCausedChanges =
148145
integrate(discoveredExternalDependencies: results.discoveredExternalDependencies)
149146
else {
@@ -200,8 +197,8 @@ extension ModuleDependencyGraph {
200197
}
201198
let results = Integrator.integrateAndCollectExternalDepNodes(
202199
from: sourceGraph,
203-
into: self,
204-
options: graph.options
200+
into: self
201+
)
205202
return results
206203
}
207204

@@ -890,7 +887,7 @@ extension ModuleDependencyGraph {
890887
for: fingerprintedExternalDependency.externalDependency.fileName))
891888
$0.append((fingerprintedExternalDependency.fingerprint != nil) ? UInt32(1) : UInt32(0))
892889
},
893-
blob: (fingerprintedExternalDependency ?? ""))
890+
blob: (fingerprintedExternalDependency.fingerprint ?? ""))
894891
}
895892
}
896893
return ByteString(serializer.stream.data)

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraphParts/DependencySource.swift

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,43 @@ public struct DependencySource: Hashable, CustomStringConvertible {
2121

2222
init(_ typedFile: TypedVirtualPath) {
2323
assert( typedFile.type == .swiftDeps ||
24-
typedFile.type == .swiftModule
25-
)
24+
typedFile.type == .swiftModule)
2625
self.typedFile = typedFile
27-
}
28-
init(_ file: VirtualPath) {
29-
let ext = file.extension
30-
let typeIfExpected =
31-
ext == FileType.swiftDeps .rawValue ? FileType.swiftDeps :
32-
ext == FileType.swiftModule.rawValue ? FileType.swiftModule
33-
: nil
34-
guard let type = typeIfExpected else {
35-
fatalError("unexpected dependencySource extension: \(String(describing: ext))")
36-
}
37-
self.init(TypedVirtualPath(file: file, type: type))
38-
}
39-
/*@_spi(Testing)*/ public init(mock i: Int) {
40-
self.init(try! VirtualPath(path: String(i) + "." + FileType.swiftDeps.rawValue))
41-
}
42-
/*@_spi(Testing)*/ public var mockID: Int {
43-
Int(file.basenameWithoutExt)!
26+
}
27+
28+
/*@_spi(Testing)*/
29+
public init(_ file: VirtualPath) {
30+
let ext = file.extension
31+
let typeIfExpected =
32+
ext == FileType.swiftDeps .rawValue ? FileType.swiftDeps :
33+
ext == FileType.swiftModule.rawValue ? FileType.swiftModule
34+
: nil
35+
guard let type = typeIfExpected else {
36+
fatalError("unexpected dependencySource extension: \(String(describing: ext))")
4437
}
4538
self.init(TypedVirtualPath(file: file, type: type))
4639
}
40+
41+
var file: VirtualPath { typedFile.file }
42+
43+
public var description: String {
44+
file.description
45+
}
46+
}
47+
48+
// MARK: - mocking
49+
extension DependencySource {
4750
/*@_spi(Testing)*/ public init(mock i: Int) {
4851
self.init(try! VirtualPath(path: String(i) + "." + FileType.swiftDeps.rawValue))
4952
}
53+
5054
/*@_spi(Testing)*/ public var mockID: Int {
5155
Int(file.basenameWithoutExt)!
5256
}
53-
var file: VirtualPath { typedFile.file }
54-
55-
public var description: String {
56-
file.description
57-
}
57+
}
5858

59+
// MARK: - reading
60+
extension DependencySource {
5961
/// Throws if a read error
6062
/// Returns nil if no dependency info there.
6163
public func read(

Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraphParts/Integrator.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ extension ModuleDependencyGraph {
3939
/// After integration is complete, contains the nodes that have disappeared.
4040
var disappearedNodes = [DependencyKey: Graph.Node]()
4141

42-
init(source: SourceFileDependencyGraph,
43-
dependencySource: DependencySource,
42+
init(sourceGraph: SourceFileDependencyGraph,
4443
destination: ModuleDependencyGraph)
4544
{
4645
self.sourceGraph = sourceGraph
47-
self.destination = destination
48-
self.disappearedNodes = destination.nodeFinder.findNodes(for: dependencySource)
46+
self .destination = destination
47+
self.disappearedNodes = destination.nodeFinder
48+
.findNodes(for: sourceGraph.dependencySource)
4949
?? [:]
5050
}
5151

@@ -62,11 +62,9 @@ extension ModuleDependencyGraph.Integrator {
6262
/// Returns changed nodes
6363
/*@_spi(Testing)*/ static func integrateAndCollectExternalDepNodes(
6464
from g: SourceFileDependencyGraph,
65-
dependencySource: Graph.DependencySource,
6665
into destination: Graph
6766
) -> Results {
68-
var integrator = Self(source: g,
69-
dependencySource: dependencySource,
67+
var integrator = Self(sourceGraph: g,
7068
destination: destination)
7169
integrator.integrate()
7270

0 commit comments

Comments
 (0)