Compute correct compiler arguments for build plugins#9583
Merged
Conversation
ahoppen
added a commit
to ahoppen/sourcekit-lsp
that referenced
this pull request
Jan 10, 2026
Member
Author
|
@swift-ci Please test |
457ec8a to
f2f69db
Compare
Member
Author
|
@swift-ci Please test |
f2f69db to
baf6fde
Compare
ahoppen
added a commit
to ahoppen/sourcekit-lsp
that referenced
this pull request
Mar 16, 2026
Member
Author
|
@swift-ci Please test |
baf6fde to
fffac48
Compare
Contributor
|
What about Swift Build? Is it already correct when using that backend? |
fffac48 to
99ed066
Compare
Member
Author
|
I haven’t been able to test it. The following test in SourceKit-LSP fails with issues from the BSP server. Regardless, I think it’s worth fixing this in the native build system and having a test for it that will catch any similar issues as we qualify the swiftbuild build system for SourceKit-LSP. So, I don’t think that fixing this in swiftbuild should be a blocker for this PR anyway. Details
func testPackagePlugin() async throws {
var options = try await SourceKitLSPOptions.testDefault()
options.swiftPMOrDefault.buildSystem = .swiftbuild
let project = try await SwiftPMTestProject(
files: [
"Test.swift": "",
"Plugins/PrintMessage/Plugin.swift": """
import PackagePlugin
@main
struct PrintMessagePlugin: CommandPlugin {
func performCommand(context: PluginContext, arguments: [String]) throws {
print("Message")
let x: String = 1
}
}
""",
],
manifest: """
import PackageDescription
let package = Package(
name: "PrintMessage",
platforms: [.macOS(.v14)],
products: [
.plugin(
name: "PrintMessage",
targets: ["PrintMessage"]
)
],
targets: [
.target(name: "MyLibrary"),
.plugin(
name: "PrintMessage",
capability: .command(
intent: .custom(
verb: "print-message",
description: "Prints message"
)
)
)
]
)
""",
options: options
)
let (uri, _) = try! project.openDocument("Plugin.swift")
let diags = try await project.testClient.send(DocumentDiagnosticsRequest(textDocument: TextDocumentIdentifier(uri)))
XCTAssertEqual(
diags.fullReport?.items.map(\.message),
["Cannot convert value of type 'Int' to specified type 'String'"]
)
} |
Member
Author
|
@swift-ci Please test |
owenv
approved these changes
Mar 26, 2026
ahoppen
added a commit
to ahoppen/sourcekit-lsp
that referenced
this pull request
Apr 2, 2026
… in SwiftPMBuildServer To stage in swiftlang/swift-package-manager#9583 because SwiftPM doesn’t support cross-PR testing.
ahoppen
added a commit
to ahoppen/sourcekit-lsp
that referenced
this pull request
Apr 2, 2026
Member
Author
|
@swift-ci Please test |
ahoppen
added a commit
to ahoppen/swift-package-manager
that referenced
this pull request
Apr 4, 2026
…ion` To stage in swiftlang#9583. Steps: 1. Merge this PR 2. Change SourceKit-LSP to pass a `pluginConfiguration` 3. Merge swiftlang#9583 4. Merge swiftlang/sourcekit-lsp#2446 for a test in SourceKit-LSP
Member
Author
|
@swift-ci Please test |
Member
Author
|
@swift-ci Please test Windows |
hamishknight
approved these changes
Apr 8, 2026
The computation of compiler arguments for package plugins was plain out broken and didn’t even include the search path to `lib/swift/pm/PluginAPI`. Call into the same logic with with we compute the build settings during building from `SourceKitLSPAPI`. Fixes swiftlang/sourcekit-lsp#2115
Member
Author
|
@swift-ci Please test |
Member
Author
|
@swift-ci Please test Windows |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The computation of compiler arguments for package plugins was plain out broken and didn’t even include the search path to
lib/swift/pm/PluginAPI. Call into the same logic with which we compute the build settings during building fromSourceKitLSPAPI.Tested as part of swiftlang/sourcekit-lsp#2446.
Fixes swiftlang/sourcekit-lsp#2115