Skip to content
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

Minimize dirtying of swift build relative to sourcekit-lsp invocations. #6648

Closed
wants to merge 3 commits into from
Closed

Minimize dirtying of swift build relative to sourcekit-lsp invocations. #6648

wants to merge 3 commits into from

Conversation

fischman-bcny
Copy link
Contributor

@fischman-bcny fischman-bcny commented Jun 13, 2023

Motivation:

On Windows, building on the command line using swift build and also using VSCode causes sourcekit-lsp to modify the .build tree, making subsequent swift builds do nontrivial work instead of being null builds.
With this PR in SwiftPM that the sourcekit-lsp is built against, this extra work is no longer done 🎉

Modifications:

Result:

The latter build in the command-line below is near instant and does no work, as expected, instead of rebuilding a whole lot of stuff: swift build && code . && sleep 30 && swift build

…ons.

Replaces a couple of writeFileContents calls with writeIfChanged to
avoid updating modification times, triggering unnecessary work in future
builds.

Also capitalize drive letters on Windows when writing
resource_bundle_accessor.swift files since VSCode (and therefore
vscode-swift) send lowercase drive letters to sourcekit-lsp, again
dirtying the output tree unnecessarily.
(vscode seems unlikely to change to use capital letters given e.g.
microsoft/vscode#42159 (comment))

Also make unrelated changes to appease snapshot swiftc where
AbsolutePath?.self is no longer valid Swift.
@tomerd
Copy link
Contributor

tomerd commented Jun 13, 2023

thanks @fischman-bcny, some follow up ideas and questions

Copy link
Contributor Author

@fischman-bcny fischman-bcny left a comment

Choose a reason for hiding this comment

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

Thanks @tomerd for the (very!) quick turnaround; please see responses inline.

Sources/Workspace/Workspace+State.swift Outdated Show resolved Hide resolved
Sources/Workspace/Workspace+State.swift Outdated Show resolved Hide resolved
@compnerd
Copy link
Member

I think that this code is now split across:
swiftlang/swift-tools-support-core#422
#6655

Going to close this off for now. Thanks @fischman-bcny for the investigation and the fix!

@compnerd compnerd closed this Jun 15, 2023
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.

5 participants