-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Prevent unnecessary rebuilds when modifying swiftc arguments #8803
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
base: main
Are you sure you want to change the base?
Conversation
Many arguments for the compiler are marked as `doesNotAffectIncrementalBuild` in `swift-driver`. Use the argument hashing in swift-driver to hash the swift compiler flags and incorporate that in to the build hash signature used to determine if SwiftPM should do a full rebuild. This prevents unnecssary rebuilds when adding or changing arguments like `-Xswiftc -diagnostic-style=llvm`. For a list of arguments that no longer affect rebuilds, search for `doesNotAffectIncrementalBuild` in https://github.com/swiftlang/swift-driver/blob/main/Sources/SwiftOptions/Options.swift. This builds on the work introduced in swiftlang#8717 which avoided unnecessary rebuilds when SwiftPM arguments changed.
@plemarquand This is huge in certain situations. Does this also cover env vars, or only command line arguments? |
@MahdiBM This patch just covers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but it would be nice to have a test for this if we can
@swift-ci please test |
Great find. Thanks @plemarquand ! |
@swift-ci test windows |
@swift-ci test macOS |
Many arguments for the compiler are marked as
doesNotAffectIncrementalBuild
inswift-driver
. Use the argument hashing in swift-driver to hash the swift compiler flags and incorporate that in to the build hash signature used to determine if SwiftPM should do a full rebuild.This prevents unnecssary rebuilds when adding or changing arguments like
-Xswiftc -diagnostic-style=llvm
. For a list of arguments that no longer affect rebuilds, search fordoesNotAffectIncrementalBuild
in https://github.com/swiftlang/swift-driver/blob/main/Sources/SwiftOptions/Options.swift.This builds on the work introduced in #8717 which avoided unnecessary rebuilds when SwiftPM arguments changed.