-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Minimize dirtying of swift build
relative to sourcekit-lsp invocations.
#6648
Conversation
…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.
thanks @fischman-bcny, some follow up ideas and questions |
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.
Thanks @tomerd for the (very!) quick turnaround; please see responses inline.
I think that this code is now split across: Going to close this off for now. Thanks @fischman-bcny for the investigation and the fix! |
Motivation:
On Windows, building on the command line using
swift build
and also using VSCode causessourcekit-lsp
to modify the.build
tree, making subsequentswift build
s 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:
writeFileContents
calls withwriteIfChanged
to avoid updating modification times, triggering unnecessary work in future builds.resource_bundle_accessor.swift
files since VSCode (and therefore vscode-swift) send lowercase drive letters tosourcekit-lsp
, again dirtying the output tree unnecessarily. (vscode seems unlikely to change to use capital letters given e.g. Windows drive letter case different between ${workspaceFolder} and integratedTerminal microsoft/vscode#42159 (comment))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