Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

plemarquand
Copy link
Contributor

@plemarquand plemarquand commented Jun 11, 2025

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 #8717 which avoided unnecessary rebuilds when SwiftPM arguments changed.

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
Copy link
Contributor Author

@swift-ci please test

@plemarquand
Copy link
Contributor Author

@swift-ci test windows

1 similar comment
@plemarquand
Copy link
Contributor Author

@swift-ci test windows

@plemarquand
Copy link
Contributor Author

@swift-ci please test windows

@MahdiBM
Copy link

MahdiBM commented Jun 12, 2025

@plemarquand This is huge in certain situations. Does this also cover env vars, or only command line arguments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants