@@ -54,25 +54,16 @@ import SwiftOptions
54
54
self . creationPhase = phase
55
55
}
56
56
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)
57
+ @_spi ( Testing) public func sourceRequired ( for input: TypedVirtualPath ,
58
+ function: String = #function,
59
+ file: String = #file,
60
+ line: Int = #line) -> DependencySource {
61
+ guard let source = inputDependencySourceMap. sourceIfKnown ( 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
-
68
- @_spi ( Testing) public func getNeededInput( for source: DependencySource ) -> TypedVirtualPath ? {
69
- guard let input = inputDependencySourceMap. getInputIfKnown ( for: source)
70
- else {
71
- info. diagnosticEngine. emit ( warning: " Failed to find source file for ' \( source. file. basename) ', recovering with a full rebuild. Next build will be incremental. " )
72
- return nil
73
- }
74
- return input
75
- }
76
67
}
77
68
78
69
extension ModuleDependencyGraph {
@@ -141,7 +132,7 @@ extension ModuleDependencyGraph {
141
132
return TransitivelyInvalidatedInputSet ( )
142
133
}
143
134
return collectInputsRequiringCompilationAfterProcessing (
144
- dependencySource: getRequiredSource ( for: input) )
135
+ dependencySource: sourceRequired ( for: input) )
145
136
}
146
137
}
147
138
@@ -161,17 +152,16 @@ extension ModuleDependencyGraph {
161
152
/// speculatively scheduled in the first wave.
162
153
func collectInputsInvalidatedBy( input: TypedVirtualPath
163
154
) -> TransitivelyInvalidatedInputArray {
164
- let changedSource = getRequiredSource ( for: input)
155
+ let changedSource = sourceRequired ( for: input)
165
156
let allDependencySourcesToRecompile =
166
157
collectSwiftDepsUsing ( dependencySource: changedSource)
167
158
168
159
return allDependencySourcesToRecompile. compactMap {
169
160
dependencySource in
170
161
guard dependencySource != changedSource else { return nil }
171
- let dependentSource = inputDependencySourceMap [ dependencySource]
172
- info. reporter? . report (
173
- " Found dependent of \( input. file. basename) : " , dependentInput)
174
- return dependentInput
162
+ let inputToRecompile = inputDependencySourceMap. inputIfKnown ( for: dependencySource)
163
+ info. reporter? . report ( " Found dependent of \( input. file. basename) : " , inputToRecompile)
164
+ return inputToRecompile
175
165
}
176
166
}
177
167
@@ -188,7 +178,7 @@ extension ModuleDependencyGraph {
188
178
/// Does the graph contain any dependency nodes for a given source-code file?
189
179
func containsNodes( forSourceFile file: TypedVirtualPath ) -> Bool {
190
180
precondition ( file. type == . swift)
191
- guard let source = inputDependencySourceMap. getSourceIfKnown ( for: file) else {
181
+ guard let source = inputDependencySourceMap. sourceIfKnown ( for: file) else {
192
182
return false
193
183
}
194
184
return containsNodes ( forDependencySource: source)
@@ -247,7 +237,7 @@ extension ModuleDependencyGraph {
247
237
func collectInputsRequiringCompilation( byCompiling input: TypedVirtualPath
248
238
) -> TransitivelyInvalidatedInputSet ? {
249
239
precondition ( input. type == . swift)
250
- let dependencySource = getRequiredSource ( for: input)
240
+ let dependencySource = sourceRequired ( for: input)
251
241
return collectInputsRequiringCompilationAfterProcessing (
252
242
dependencySource: dependencySource)
253
243
}
@@ -342,7 +332,10 @@ extension ModuleDependencyGraph {
342
332
) -> TransitivelyInvalidatedInputSet ? {
343
333
var invalidatedInputs = TransitivelyInvalidatedInputSet ( )
344
334
for invalidatedSwiftDeps in collectSwiftDepsUsingInvalidated ( nodes: directlyInvalidatedNodes) {
345
- guard let invalidatedInput = input ( neededFor: invalidatedSwiftDeps) else {
335
+ guard let invalidatedInput = inputDependencySourceMap. inputIfKnown ( for: invalidatedSwiftDeps)
336
+ else {
337
+ info. diagnosticEngine. emit (
338
+ warning: " Failed to find source file for ' \( invalidatedSwiftDeps. file. basename) ', recovering with a full rebuild. Next build will be incremental. " )
346
339
return nil
347
340
}
348
341
invalidatedInputs. insert ( invalidatedInput)
0 commit comments