mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
[SwiftPM] Switch from BuildTriple to BuildDestination
`BuildTriple` is going away to it's as good time as any to introduce a new type to be used by SourceKit-LSP. Paired with https://github.com/swiftlang/swift-package-manager/pull/7884
This commit is contained in:
@@ -69,13 +69,17 @@ private func preferredToolchain(_ toolchainRegistry: ToolchainRegistry) async ->
|
||||
])
|
||||
}
|
||||
|
||||
fileprivate extension BuildTriple {
|
||||
fileprivate extension BuildDestination {
|
||||
/// A string that can be used to identify the build triple in `ConfiguredTarget.runDestinationID`.
|
||||
///
|
||||
/// `BuildSystemManager.canonicalConfiguredTarget` picks the canonical target based on alphabetical
|
||||
/// ordering. We rely on the string "destination" being ordered before "tools" so that we prefer a
|
||||
/// `destination` (or "target") target over a `tools` (or "host") target.
|
||||
var id: String {
|
||||
switch self {
|
||||
case .tools:
|
||||
case .host:
|
||||
return "tools"
|
||||
case .destination:
|
||||
case .target:
|
||||
return "destination"
|
||||
}
|
||||
}
|
||||
@@ -83,7 +87,7 @@ fileprivate extension BuildTriple {
|
||||
|
||||
fileprivate extension ConfiguredTarget {
|
||||
init(_ buildTarget: any SwiftBuildTarget) {
|
||||
self.init(targetID: buildTarget.name, runDestinationID: buildTarget.buildTriple.id)
|
||||
self.init(targetID: buildTarget.name, runDestinationID: buildTarget.destination.id)
|
||||
}
|
||||
|
||||
static let forPackageManifest = ConfiguredTarget(targetID: "", runDestinationID: "")
|
||||
|
||||
Reference in New Issue
Block a user