Stop emitting .swiftsourceinfo if not explicitly requested - #1895
Merged
Conversation
adincebic
requested review from
aaronsky,
brentleyjones,
keith and
luispadron
as code owners
September 6, 2026 12:17
adincebic
force-pushed
the
adin/stop-emiting-swiftsourceinfo
branch
from
September 6, 2026 12:35
810608f to
311176b
Compare
aaronsky
approved these changes
Sep 9, 2026
Contributor
Author
|
Relevant Slack thread: https://bazelbuild.slack.com/archives/C096TL199U0/p1788956785964199 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Up until this point the feature
swift.emit_swiftsourceinfowas only controlling whether Bazel should track the file as its output. This meant that.swiftsourceinfowas produced but not tracked by Bazel. Now we make sure thatswiftcdoes not produce.swiftsourceinfoif not explicitly requested.I also deleted the code which made sure that
.swiftsourceinfowas part of the incremental compilation since that is not true today.The
.swiftsourceinfohandling was originally added in PR #698 (#698) so Swift could skip the merge-module job. Source compilation was already being skipped, but module merging still had to run because the declared.swiftsourceinfooutput was missing. At the time source info was always emitted, so keeping it around made sense.Now that source info is optional, both cases are handled:
.swiftsourceinfois still declared, emitted, and preserved.-avoid-emit-module-source-infoand don't expect.swiftsourceinfofrom the merge-module job, so that job can still be skipped.This also lines up with what the Swift driver does:
doesNotAffectIncrementalBuild(https://github.com/swiftlang/swift-driver/blob/e1d6a2fefe27dd2d7cfae18154a250c846743deb/Sources/SwiftOptions/Options.swift#L49)..priorsdependency graph (https://github.com/swiftlang/swift-driver/blob/e1d6a2fefe27dd2d7cfae18154a250c846743deb/Sources/SwiftDriver/IncrementalCompilation/IncrementalDependencyAndInputSetup.swift#L256-L277), using per-source.swiftdepsfiles (https://github.com/swiftlang/swift-driver/blob/e1d6a2fefe27dd2d7cfae18154a250c846743deb/Sources/SwiftDriver/IncrementalCompilation/ModuleDependencyGraphParts/DependencySource.swift#L103-L120)..swiftsourceinfois computed separately as an optional auxiliary output (https://github.com/swiftlang/swift-driver/blob/e1d6a2fefe27dd2d7cfae18154a250c846743deb/Sources/SwiftDriver/Driver/Driver.swift#L4088-L4109).Relevant Slack thread: https://bazelbuild.slack.com/archives/C096TL199U0/p1788956785964199