@@ -54,20 +54,21 @@ import SwiftOptions
54
54
self . creationPhase = phase
55
55
}
56
56
57
- @_spi ( Testing) public func getSource ( for input: TypedVirtualPath ,
58
- function: String = #function,
59
- file: String = #file,
60
- line: Int = #line) -> DependencySource {
61
- guard let source = inputDependencySourceMap. getSource ( for: input)
57
+ @_spi ( Testing) public func getRequiredSource ( for input: TypedVirtualPath ,
58
+ function: String = #function,
59
+ file: String = #file,
60
+ line: Int = #line) -> DependencySource {
61
+ guard let source = inputDependencySourceMap. getSourceIfKnown ( for: input)
62
62
else {
63
63
fatalError ( " \( input. file. basename) not found in inputDependencySourceMap, \( file) : \( line) in \( function) " )
64
64
}
65
65
return source
66
66
}
67
- @_spi ( Testing) public func getInput( for source: DependencySource ) -> TypedVirtualPath ? {
67
+
68
+ @_spi ( Testing) public func getNeededInput( for source: DependencySource ) -> TypedVirtualPath ? {
68
69
guard let input =
69
70
info. simulateGetInputFailure ? nil
70
- : inputDependencySourceMap. getInput ( for: source)
71
+ : inputDependencySourceMap. getInputIfKnown ( for: source)
71
72
else {
72
73
info. diagnosticEngine. emit ( warning: " Failed to find source file for ' \( source. file. basename) ', recovering with a full rebuild. Next build will be incremental. " )
73
74
info. reporter? . report (
@@ -144,7 +145,7 @@ extension ModuleDependencyGraph {
144
145
return TransitivelyInvalidatedInputSet ( )
145
146
}
146
147
return collectInputsRequiringCompilationAfterProcessing (
147
- dependencySource: getSource ( for: input) )
148
+ dependencySource: getRequiredSource ( for: input) )
148
149
}
149
150
}
150
151
@@ -166,14 +167,14 @@ extension ModuleDependencyGraph {
166
167
/// speculatively scheduled in the first wave.
167
168
func collectInputsInvalidatedBy( input: TypedVirtualPath
168
169
) -> TransitivelyInvalidatedInputArray {
169
- let changedSource = getSource ( for: input)
170
+ let changedSource = getRequiredSource ( for: input)
170
171
let allDependencySourcesToRecompile =
171
172
collectSwiftDepsUsing ( dependencySource: changedSource)
172
173
173
174
return allDependencySourcesToRecompile. compactMap {
174
175
depedencySource in
175
176
guard depedencySource != changedSource else { return nil }
176
- let dependentInput = inputDependencySourceMap. getInput ( for: depedencySource)
177
+ let dependentInput = inputDependencySourceMap. getInputIfKnown ( for: depedencySource)
177
178
info. reporter? . report (
178
179
" Found dependent of \( input. file. basename) : " , dependentInput)
179
180
return dependentInput
@@ -193,7 +194,7 @@ extension ModuleDependencyGraph {
193
194
/// Does the graph contain any dependency nodes for a given source-code file?
194
195
func containsNodes( forSourceFile file: TypedVirtualPath ) -> Bool {
195
196
precondition ( file. type == . swift)
196
- guard let source = inputDependencySourceMap. getSource ( for: file) else {
197
+ guard let source = inputDependencySourceMap. getSourceIfKnown ( for: file) else {
197
198
return false
198
199
}
199
200
return containsNodes ( forDependencySource: source)
@@ -253,7 +254,7 @@ extension ModuleDependencyGraph {
253
254
func collectInputsRequiringCompilation( byCompiling input: TypedVirtualPath
254
255
) -> TransitivelyInvalidatedInputSet ? {
255
256
precondition ( input. type == . swift)
256
- let dependencySource = getSource ( for: input)
257
+ let dependencySource = getRequiredSource ( for: input)
257
258
return collectInputsRequiringCompilationAfterProcessing (
258
259
dependencySource: dependencySource)
259
260
}
@@ -340,7 +341,7 @@ extension ModuleDependencyGraph {
340
341
) -> TransitivelyInvalidatedInputSet ? {
341
342
var invalidatedInputs = TransitivelyInvalidatedInputSet ( )
342
343
for invalidatedSwiftDeps in collectSwiftDepsUsingInvalidated ( nodes: directlyInvalidatedNodes) {
343
- guard let invalidatedInput = getInput ( for: invalidatedSwiftDeps)
344
+ guard let invalidatedInput = getNeededInput ( for: invalidatedSwiftDeps)
344
345
else {
345
346
return nil
346
347
}
0 commit comments