Skip to content

[6.1] Allow workspace options to affect build system search #1952

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 8 commits into from
Jan 25, 2025

Conversation

bnbarham
Copy link
Contributor

  • Explanation: Fixes various cases where workspace options would not affect build system search. Includes some refactoring commits to reduce the number of conflicts.
  • Scope: Build system search
  • Original PRs: Allow workspace options to affect build system search #1889
  • Risk: Low-ish. This does change the way we search for build systems, which is somewhat risky. But it fixes a fairly serious issue when we create implicit workspaces (which caused us to create a new clangd on every request).
  • Testing: New test cases to check workspace options impact search
  • Reviewers: @ahoppen

ahoppen and others added 7 commits January 23, 2025 11:42
We are already logging the options below.

(cherry picked from commit 760be31)
This was a small refactoring in a much larger PR.
This allows us to clean up the creation of `TestBuildSystem` a little bit because the tests can create `TestBuildSystem` instead of retrieving it from the `BuildSystemManager`.

rdar://142906050
(cherry picked from commit 31b1909)
If you have a package located at `/pkg` and a symlink at `/symlink` and you open `/symlink` as a workspace, the SwiftPMBuildSystem’s project root would be `/pkg`. This would mean that it also only knew about build settings for files in `/pkg`, not in `/symlink`. Thus, whenever we were opening a file in `/symlink` we would create an implicit workspace to handle it (but which ended up having a project root at `/symlink` again) – or something close to this.

We shouldn’t need to realpath here. If you open `/symlink`, we should view `/symlink` as the project root of your workspace.

(cherry picked from commit 8617b8b)
There were a few places that options only took place *after* determining
a build system, even though we have multiple that impact the search (eg.
`defaultBuildSystem` and `searchPaths`).

Additionally track project root and configuration paths separately, so
that when searching for implicit workspaces we can make sure to skip
creating duplicates.

(cherry picked from commit 0c89669)
@bnbarham bnbarham requested a review from ahoppen as a code owner January 23, 2025 23:37
@bnbarham
Copy link
Contributor Author

@swift-ci please test

(cherry picked from commit 44bd97b)
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@ahoppen
Copy link
Member

ahoppen commented Jan 24, 2025

@swift-ci Please test Windows

@bnbarham
Copy link
Contributor Author

@swift-ci please test Windows

@bnbarham bnbarham merged commit 89f7613 into swiftlang:release/6.1 Jan 25, 2025
3 checks passed
@bnbarham bnbarham deleted the cherry-workspace-fixes branch January 25, 2025 04:37
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