Skip to content

Revert "[Planning] Avoid batching compile job twice" #1826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions Sources/SwiftDriver/Jobs/Planning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down