From 6603491b4fc6ef4fb54345c12b69cb02013a2641 Mon Sep 17 00:00:00 2001 From: Owen Voorhees Date: Mon, 3 Mar 2025 09:59:37 -0800 Subject: [PATCH] Revert "[Planning] Avoid batching compile job twice" This reverts commit 7ba9d485ab44cca5c61cf974679d6fba91feb1ca. --- Sources/SwiftDriver/Jobs/Planning.swift | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Sources/SwiftDriver/Jobs/Planning.swift b/Sources/SwiftDriver/Jobs/Planning.swift index ed801aba3..53462039d 100644 --- a/Sources/SwiftDriver/Jobs/Planning.swift +++ b/Sources/SwiftDriver/Jobs/Planning.swift @@ -90,17 +90,16 @@ extension Driver { incrementalCompilationState = nil } - let batchedJobs: [Job] - // If the jobs are batched during the incremental build, reuse the computation rather than computing the batches again. - if let incrementalState = incrementalCompilationState { - batchedJobs = incrementalState.mandatoryJobsInOrder + incrementalState.jobsAfterCompiles - } else { - batchedJobs = try formBatchedJobs(jobsInPhases.allJobs, - showJobLifecycle: showJobLifecycle, - jobCreatingPch: jobsInPhases.allJobs.first(where: {$0.kind == .generatePCH})) - } - - return (batchedJobs, incrementalCompilationState) + return try ( + // For compatibility with swiftpm, the driver produces batched jobs + // for every job, even when run in incremental mode, so that all jobs + // can be returned from `planBuild`. + // But in that case, don't emit lifecycle messages. + formBatchedJobs(jobsInPhases.allJobs, + showJobLifecycle: showJobLifecycle && incrementalCompilationState == nil, + jobCreatingPch: jobsInPhases.allJobs.first(where: {$0.kind == .generatePCH})), + incrementalCompilationState + ) } /// If performing an explicit module build, compute an inter-module dependency graph.