Skip to content

Allow overriding SwiftPM's build directory with background indexing #2193

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 2 commits into from
Jul 2, 2025

Conversation

bnbarham
Copy link
Contributor

If scratchPath is explicitly set, use it over the separate index-build arena even when background indexing is enabled.

If `scratchPath` is explicitly set, use it over the separate
`index-build` arena even when background indexing is enabled.
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@bnbarham
Copy link
Contributor Author

bnbarham commented Jul 1, 2025

@swift-ci please test

@bnbarham
Copy link
Contributor Author

bnbarham commented Jul 1, 2025

Also applied formatting changes caused by swiftlang/swift-format#1039 (ideally we'd have github actions and use the latest release here but...)

@bnbarham
Copy link
Contributor Author

bnbarham commented Jul 1, 2025

@swift-ci please test Windows platform

@bnbarham bnbarham merged commit 2f0a8af into swiftlang:main Jul 2, 2025
3 checks passed
@bnbarham bnbarham deleted the allow-scratch-override branch July 2, 2025 20:33
if options.backgroundIndexingOrDefault {
location.scratchDirectory = absProjectRoot.appending(components: ".build", "index-build")
} else if let scratchDirectory = options.swiftPMOrDefault.scratchPath {
if let scratchDirectory = options.swiftPMOrDefault.scratchPath {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should use an index-build folder within the scratch directory for background indexing. Say a user stores their build directory in .my-build instead of .build for some reason. In that case they might specify .my-build as the scratch path but we‘d probably still want to use a separate build arena for background indexing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was torn on this. Technically there's no reason to match up their build + what's passed to sourcekit-lsp today, since we have a separate arena anyway. So if it is passed... seems weird to then tack on the arena?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess… My opinion isn’t strong enough to argue about this.

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.

3 participants