@@ -116,8 +116,6 @@ import SwiftOptions
116116 self . pendingInputs = Set ( immediatelyCompiledInputs)
117117 self . moduleDependencyGraph = moduleDependencyGraph
118118 self . reportIncrementalDecision = reportIncrementalDecision
119-
120- maybeFinishedWithCompilations ( )
121119 }
122120
123121 /// Check various arguments to rule out incremental compilation if need be.
@@ -370,14 +368,19 @@ extension IncrementalCompilationState {
370368extension IncrementalCompilationState {
371369 /// Decide if a job can be skipped, and register accordingly
372370 func addPreOrCompileJobGroups( _ groups: [ [ Job ] ] ) {
371+ var wereAnyJobsScheduled = false
373372 for group in groups {
374373 if let firstJob = group. first, isSkipped ( firstJob) {
375374 recordSkippedGroup ( group)
376375 }
377376 else {
378377 schedule ( group: group)
378+ wereAnyJobsScheduled = true
379379 }
380380 }
381+ if !wereAnyJobsScheduled {
382+ finishedWithCompilations ( )
383+ }
381384 }
382385
383386 func isSkipped( _ job: Job ) -> Bool {
@@ -451,7 +454,9 @@ extension IncrementalCompilationState {
451454 }
452455 schedule ( compilationInputs: discoveredInputs)
453456 finishedJob. primaryInputs. forEach { pendingInputs. remove ( $0) }
454- maybeFinishedWithCompilations ( )
457+ if pendingInputs. isEmpty {
458+ finishedWithCompilations ( )
459+ }
455460 }
456461
457462 private func collectInputsDiscovered(
@@ -483,11 +488,7 @@ extension IncrementalCompilationState {
483488 schedule ( preOrCompileJobs: jobs)
484489 }
485490
486- func maybeFinishedWithCompilations( ) {
487- guard pendingInputs. isEmpty
488- else {
489- return
490- }
491+ func finishedWithCompilations( ) {
491492 preOrCompileJobs. enqueue ( nil )
492493 }
493494}
0 commit comments