@@ -63,8 +63,10 @@ public class IncrementalCompilationState {
63
63
return nil
64
64
}
65
65
66
- guard let ( moduleDependencyGraph,
67
- inputsHavingMalformedSwiftDeps: inputsHavingMalformedSwiftDeps) =
66
+ guard let (
67
+ moduleDependencyGraph,
68
+ inputsHavingMalformedDependencySources: inputsHavingMalformedDependencySources
69
+ ) =
68
70
Self . computeModuleDependencyGraph (
69
71
buildRecordInfo,
70
72
outOfDateBuildRecord,
@@ -81,7 +83,7 @@ public class IncrementalCompilationState {
81
83
& driver,
82
84
buildRecordInfo,
83
85
outOfDateBuildRecord,
84
- inputsHavingMalformedSwiftDeps : inputsHavingMalformedSwiftDeps ,
86
+ inputsHavingMalformedDependencySources : inputsHavingMalformedDependencySources ,
85
87
moduleDependencyGraph,
86
88
self . reporter)
87
89
@@ -99,42 +101,46 @@ public class IncrementalCompilationState {
99
101
_ driver: inout Driver ,
100
102
_ reporter: Reporter ?
101
103
)
102
- -> ( ModuleDependencyGraph , inputsHavingMalformedSwiftDeps: [ TypedVirtualPath ] ) ?
104
+ -> ( ModuleDependencyGraph ,
105
+ inputsHavingMalformedDependencySources: [ TypedVirtualPath ] ) ?
103
106
{
104
107
let diagnosticEngine = driver. diagnosticEngine
105
- guard let ( moduleDependencyGraph, inputsWithMalformedSwiftDeps: inputsWithMalformedSwiftDeps) =
106
- ModuleDependencyGraph . buildInitialGraph (
107
- diagnosticEngine: diagnosticEngine,
108
- inputs: buildRecordInfo. compilationInputModificationDates. keys,
109
- previousInputs: outOfDateBuildRecord. allInputs,
110
- outputFileMap: outputFileMap,
111
- parsedOptions: & driver. parsedOptions,
112
- remarkDisabled: Diagnostic . Message. remark_incremental_compilation_has_been_disabled,
113
- reporter: reporter,
114
- fileSystem: driver. fileSystem)
108
+ guard let (
109
+ moduleDependencyGraph,
110
+ inputsAndMalformedDependencySources: inputsAndMalformedDependencySources
111
+ ) =
112
+ ModuleDependencyGraph . buildInitialGraph (
113
+ diagnosticEngine: diagnosticEngine,
114
+ inputs: buildRecordInfo. compilationInputModificationDates. keys,
115
+ previousInputs: outOfDateBuildRecord. allInputs,
116
+ outputFileMap: outputFileMap,
117
+ parsedOptions: & driver. parsedOptions,
118
+ remarkDisabled: Diagnostic . Message. remark_incremental_compilation_has_been_disabled,
119
+ reporter: reporter,
120
+ fileSystem: driver. fileSystem)
115
121
else {
116
122
return nil
117
123
}
118
124
// Preserve legacy behavior,
119
- // but someday, just ensure inputsWithUnreadableSwiftDeps are compiled
120
- if let badSwiftDeps = inputsWithMalformedSwiftDeps . first? . 1 {
125
+ // but someday, just ensure inputsAndMalformedDependencySources are compiled
126
+ if let badDependencySource = inputsAndMalformedDependencySources . first? . 1 {
121
127
diagnosticEngine. emit (
122
128
. remark_incremental_compilation_has_been_disabled(
123
- because: " malformed swift dependencies file ' \( badSwiftDeps ) ' " )
129
+ because: " malformed dependencies file ' \( badDependencySource ) ' " )
124
130
)
125
131
return nil
126
132
}
127
- let inputsHavingMalformedSwiftDeps = inputsWithMalformedSwiftDeps . map { $0. 0 }
133
+ let inputsHavingMalformedDependencySources = inputsAndMalformedDependencySources . map { $0. 0 }
128
134
return ( moduleDependencyGraph,
129
- inputsHavingMalformedSwiftDeps : inputsHavingMalformedSwiftDeps )
135
+ inputsHavingMalformedDependencySources : inputsHavingMalformedDependencySources )
130
136
}
131
137
132
138
private static func computeInputsAndGroups(
133
139
_ jobsInPhases: JobsInPhases ,
134
140
_ driver: inout Driver ,
135
141
_ buildRecordInfo: BuildRecordInfo ,
136
142
_ outOfDateBuildRecord: BuildRecord ,
137
- inputsHavingMalformedSwiftDeps : [ TypedVirtualPath ] ,
143
+ inputsHavingMalformedDependencySources : [ TypedVirtualPath ] ,
138
144
_ moduleDependencyGraph: ModuleDependencyGraph ,
139
145
_ reporter: Reporter ?
140
146
) throws -> ( skippedCompileGroups: [ TypedVirtualPath : CompileJobGroup ] ,
@@ -148,7 +154,7 @@ public class IncrementalCompilationState {
148
154
allGroups: jobsInPhases. compileGroups,
149
155
fileSystem: driver. fileSystem,
150
156
buildRecordInfo: buildRecordInfo,
151
- inputsHavingMalformedSwiftDeps : inputsHavingMalformedSwiftDeps ,
157
+ inputsHavingMalformedDependencySources : inputsHavingMalformedDependencySources ,
152
158
moduleDependencyGraph: moduleDependencyGraph,
153
159
outOfDateBuildRecord: outOfDateBuildRecord,
154
160
alwaysRebuildDependents: driver. parsedOptions. contains ( . driverAlwaysRebuildDependents) ,
@@ -270,7 +276,7 @@ extension IncrementalCompilationState {
270
276
allGroups: [ CompileJobGroup ] ,
271
277
fileSystem: FileSystem ,
272
278
buildRecordInfo: BuildRecordInfo ,
273
- inputsHavingMalformedSwiftDeps : [ TypedVirtualPath ] ,
279
+ inputsHavingMalformedDependencySources : [ TypedVirtualPath ] ,
274
280
moduleDependencyGraph: ModuleDependencyGraph ,
275
281
outOfDateBuildRecord: BuildRecord ,
276
282
alwaysRebuildDependents: Bool ,
@@ -299,7 +305,7 @@ extension IncrementalCompilationState {
299
305
// Combine to obtain the inputs that definitely must be recompiled.
300
306
let definitelyRequiredInputs =
301
307
Set ( changedInputs. map ( { $0. filePath } ) + externalDependents +
302
- inputsHavingMalformedSwiftDeps
308
+ inputsHavingMalformedDependencySources
303
309
+ inputsMissingOutputs)
304
310
if let reporter = reporter {
305
311
for scheduledInput in definitelyRequiredInputs. sorted ( by: { $0. file. name < $1. file. name} ) {
@@ -402,31 +408,31 @@ extension IncrementalCompilationState {
402
408
moduleDependencyGraph: ModuleDependencyGraph ,
403
409
reporter: IncrementalCompilationState . Reporter ?
404
410
) -> [ TypedVirtualPath ] {
405
- var externallyDependentSwiftDeps = Set < ModuleDependencyGraph . SwiftDeps > ( )
411
+ var externalDependencySources = Set < ModuleDependencyGraph . DependencySource > ( )
406
412
for extDep in moduleDependencyGraph. externalDependencies {
407
413
let extModTime = extDep. file. flatMap {
408
414
try ? fileSystem. getFileInfo ( $0) . modTime}
409
415
?? Date . distantFuture
410
416
if extModTime >= buildTime {
411
417
for dependent in moduleDependencyGraph. untracedDependents ( of: extDep) {
412
- guard let swiftDeps = dependent. swiftDeps else {
413
- fatalError ( " Dependent \( dependent) does not have swiftdeps file! " )
418
+ guard let dependencySource = dependent. dependencySource else {
419
+ fatalError ( " Dependent \( dependent) does not have dependencies source file! " )
414
420
}
415
421
reporter? . report (
416
422
" Queuing because of external dependency on newer \( extDep. file? . basename ?? " extDep? " ) " ,
417
- path: TypedVirtualPath ( file: swiftDeps . file, type: . swiftDeps) )
418
- externallyDependentSwiftDeps . insert ( swiftDeps )
423
+ path: TypedVirtualPath ( file: dependencySource . file, type: . swiftDeps) )
424
+ externalDependencySources . insert ( dependencySource )
419
425
}
420
426
}
421
427
}
422
- return externallyDependentSwiftDeps . compactMap {
423
- moduleDependencyGraph. sourceSwiftDepsMap [ $0]
428
+ return externalDependencySources . compactMap {
429
+ moduleDependencyGraph. inputDependencySourceMap [ $0]
424
430
}
425
431
}
426
432
427
433
/// Returns the cascaded files to compile in the first wave, even though it may not be need.
428
434
/// The needs[Non}CascadingBuild stuff was cargo-culted from the legacy driver.
429
- /// TODO: something better, e.g. return nothing here, but process changed swiftDeps
435
+ /// TODO: something better, e.g. return nothing here, but process changed dependencySource
430
436
/// before the whole frontend job finished.
431
437
private static func computeSpeculativeInputs(
432
438
changedInputs: [ ChangedInput ] ,
@@ -436,10 +442,11 @@ extension IncrementalCompilationState {
436
442
alwaysRebuildDependents: Bool ,
437
443
reporter: IncrementalCompilationState . Reporter ?
438
444
) -> Set < TypedVirtualPath > {
439
- let cascadingChangedInputs = Self . computeCascadingChangedInputs ( from: changedInputs,
440
- inputsMissingOutputs: inputsMissingOutputs,
441
- alwaysRebuildDependents: alwaysRebuildDependents,
442
- reporter: reporter)
445
+ let cascadingChangedInputs = Self . computeCascadingChangedInputs (
446
+ from: changedInputs,
447
+ inputsMissingOutputs: inputsMissingOutputs,
448
+ alwaysRebuildDependents: alwaysRebuildDependents,
449
+ reporter: reporter)
443
450
let cascadingExternalDependents = alwaysRebuildDependents ? externalDependents : [ ]
444
451
// Collect the dependent files to speculatively schedule
445
452
var dependentFiles = Set < TypedVirtualPath > ( )
@@ -554,7 +561,7 @@ extension IncrementalCompilationState {
554
561
if let found = moduleDependencyGraph. findSourcesToCompileAfterCompiling ( input, on: self . driver. fileSystem) {
555
562
return found
556
563
}
557
- self . reporter? . report ( " Failed to read some swiftdeps ; compiling everything " , path: input)
564
+ self . reporter? . report ( " Failed to read some dependencies source ; compiling everything " , path: input)
558
565
return Array ( skippedCompileGroups. keys)
559
566
}
560
567
)
0 commit comments