@@ -118,6 +118,7 @@ public class IncrementalCompilationState {
118
118
buildRecordInfo: buildRecordInfo,
119
119
moduleDependencyGraph: moduleDependencyGraph,
120
120
outOfDateBuildRecord: outOfDateBuildRecord,
121
+ alwaysRebuildDependents: parsedOptions. contains ( . driverAlwaysRebuildDependents) ,
121
122
reportIncrementalDecision: reportIncrementalDecision)
122
123
123
124
self . moduleDependencyGraph = moduleDependencyGraph
@@ -208,6 +209,7 @@ extension IncrementalCompilationState {
208
209
buildRecordInfo: BuildRecordInfo ,
209
210
moduleDependencyGraph: ModuleDependencyGraph ,
210
211
outOfDateBuildRecord: BuildRecord ,
212
+ alwaysRebuildDependents: Bool ,
211
213
reportIncrementalDecision: ( ( String , TypedVirtualPath ? ) -> Void ) ?
212
214
) -> Set < TypedVirtualPath > {
213
215
@@ -238,6 +240,7 @@ extension IncrementalCompilationState {
238
240
let speculativeInputs = computeSpeculativeInputs (
239
241
changedInputs: changedInputs,
240
242
moduleDependencyGraph: moduleDependencyGraph,
243
+ alwaysRebuildDependents: alwaysRebuildDependents,
241
244
reportIncrementalDecision: reportIncrementalDecision)
242
245
. subtracting ( definitelyRequiredInputs)
243
246
@@ -330,26 +333,32 @@ extension IncrementalCompilationState {
330
333
private static func computeSpeculativeInputs(
331
334
changedInputs: [ ( TypedVirtualPath , InputInfo . Status ) ] ,
332
335
moduleDependencyGraph: ModuleDependencyGraph ,
336
+ alwaysRebuildDependents: Bool ,
333
337
reportIncrementalDecision: ( ( String , TypedVirtualPath ? ) -> Void ) ?
334
338
) -> Set < TypedVirtualPath > {
335
339
// Collect the files that will be compiled whose dependents should be schedule
336
340
let cascadingFiles : [ TypedVirtualPath ] = changedInputs. compactMap { input, status in
337
341
let basename = input. file. basename
338
- switch status {
339
- case . needsCascadingBuild:
342
+ switch ( status, alwaysRebuildDependents) {
343
+
344
+ case ( _, true ) :
345
+ reportIncrementalDecision ? (
346
+ " scheduling dependents of \( basename) ; -driver-always-rebuild-dependents " , nil )
347
+ return input
348
+ case ( . needsCascadingBuild, false ) :
340
349
reportIncrementalDecision ? (
341
350
" scheduling dependents of \( basename) ; needed cascading build " , nil )
342
351
return input
343
352
344
- case . upToDate: // Must be building because it changed
353
+ case ( . upToDate, false ) : // was up to date, but changed
345
354
reportIncrementalDecision ? (
346
355
" not scheduling dependents of \( basename) ; unknown changes " , nil )
347
356
return nil
348
- case . newlyAdded:
357
+ case ( . newlyAdded, false ) :
349
358
reportIncrementalDecision ? (
350
359
" not scheduling dependents of \( basename) : no entry in build record or dependency graph " , nil )
351
360
return nil
352
- case . needsNonCascadingBuild:
361
+ case ( . needsNonCascadingBuild, false ) :
353
362
reportIncrementalDecision ? (
354
363
" not scheduling dependents of \( basename) : does not need cascading build " , nil )
355
364
return nil
0 commit comments