Skip to content

Commit aa7ff70

Browse files
authored
Merge pull request #2300 from ahoppen/drop-6.1
Drop support for building with Swift 6.1
2 parents 078a996 + c7ca73a commit aa7ff70

File tree

7 files changed

+5
-91
lines changed

7 files changed

+5
-91
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 6.1
1+
// swift-tools-version: 6.2
22

33
import Foundation
44
import PackageDescription

Sources/BuildServerIntegration/LegacyBuildServer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import SKOptions
2020
import SwiftExtensions
2121
import ToolchainRegistry
2222

23-
#if compiler(>=6.3)
24-
#warning("We have had a one year transition period to the pull based build server. Consider removing this build server")
23+
#if compiler(>=6.5)
24+
#warning("We have had a two year transition period to the pull based build server. Consider removing this build server")
2525
#endif
2626

2727
/// Bridges the gap between the legacy push-based BSP settings model and the new pull based BSP settings model.

Sources/CompletionScoring/Utilities/SwiftExtensions.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,6 @@ protocol ContiguousZeroBasedIndexedCollection: Collection where Index == Int {
289289
var indices: Range<Int> { get }
290290
}
291291

292-
#if compiler(<6.2)
293-
/// Provide a compatibility layer for `SendableMetatype` if it doesn't exist in the compiler
294-
typealias SendableMetatype = Any
295-
#endif
296-
297292
extension ContiguousZeroBasedIndexedCollection {
298293
func slicedConcurrentForEachSliceRange(body: @Sendable (Range<Index>) -> Void) where Self: SendableMetatype {
299294
// We want to use `DispatchQueue.concurrentPerform`, but we want to be called only a few times. So that we

Sources/SourceKitD/SourceKitD.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,6 @@ package actor SourceKitD {
173173
pluginPaths: PluginPaths?
174174
) async throws -> SourceKitD {
175175
try await SourceKitDRegistry.shared.getOrAdd(dylibPath, pluginPaths: pluginPaths) {
176-
#if canImport(Darwin)
177-
#if compiler(>=6.3)
178-
#warning("Remove this when we no longer need to support sourcekitd_plugin_initialize")
179-
#endif
180-
if let pluginPaths {
181-
try setenv(
182-
name: "SOURCEKIT_LSP_PLUGIN_SOURCEKITD_PATH_\(pluginPaths.clientPlugin.realpath.filePath)",
183-
value: dylibPath.filePath,
184-
override: false
185-
)
186-
}
187-
#endif
188176
return try SourceKitD(dylib: dylibPath, pluginPaths: pluginPaths)
189177
}
190178
}

Sources/SwiftLanguageService/CodeActions/SyntaxCodeActionProvider.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ import SourceKitLSP
1616
import SwiftRefactor
1717
import SwiftSyntax
1818

19-
#if compiler(<6.2)
20-
/// Provide a compatibility layer for `SendableMetatype` if it doesn't exist in the compiler
21-
typealias SendableMetatype = Any
22-
#endif
23-
2419
/// Describes types that provide one or more code actions based on purely
2520
/// syntactic information.
2621
protocol SyntaxCodeActionProvider: SendableMetatype {

Sources/SwiftSourceKitClientPlugin/ClientPlugin.swift

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,11 @@ import SourceKitD
1616
import SwiftExtensions
1717
import SwiftSourceKitPluginCommon
1818

19-
#if compiler(>=6.3)
20-
#warning("Remove sourcekitd_plugin_initialize when we no longer support toolchains that call it")
21-
#endif
22-
2319
/// Legacy plugin initialization logic in which sourcekitd does not inform the plugin about the sourcekitd path it was
2420
/// loaded from.
2521
@_cdecl("sourcekitd_plugin_initialize")
2622
public func sourcekitd_plugin_initialize(_ params: sourcekitd_api_plugin_initialize_params_t) {
27-
#if canImport(Darwin)
28-
var dlInfo = Dl_info()
29-
dladdr(#dsohandle, &dlInfo)
30-
let path = String(cString: dlInfo.dli_fname)
31-
let clientPluginDylibUrl = URL(fileURLWithPath: path, isDirectory: false)
32-
var url = clientPluginDylibUrl
33-
while url.pathExtension != "framework" && url.lastPathComponent != "/" {
34-
url.deleteLastPathComponent()
35-
}
36-
url =
37-
url
38-
.deletingLastPathComponent()
39-
.appendingPathComponent("sourcekitd.framework")
40-
.appendingPathComponent("sourcekitd")
41-
if !FileManager.default.fileExists(at: url),
42-
let clientPluginDylibUrlRealpath = try? clientPluginDylibUrl.realpath.filePath,
43-
let sourcekitdPath = ProcessInfo.processInfo.environment[
44-
"SOURCEKIT_LSP_PLUGIN_SOURCEKITD_PATH_\(clientPluginDylibUrlRealpath)"
45-
]
46-
{
47-
// When using a SourceKit plugin from the build directory, we can't find sourcekitd relative to the plugin.
48-
// Respect the sourcekitd path that was passed to us via an environment variable from
49-
// `SourceKitD.getOrCreate`.
50-
url = URL(fileURLWithPath: sourcekitdPath)
51-
}
52-
try! url.filePath.withCString { sourcekitdPath in
53-
sourcekitd_plugin_initialize_2(params, sourcekitdPath)
54-
}
55-
#else
56-
fatalError("sourcekitd_plugin_initialize is not supported on non-Darwin platforms")
57-
#endif
23+
fatalError("sourcekitd_plugin_initialize has been removed in favor of sourcekitd_plugin_initialize_2")
5824
}
5925

6026
@_cdecl("sourcekitd_plugin_initialize_2")

Sources/SwiftSourceKitPlugin/Plugin.swift

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -157,41 +157,11 @@ final class RequestHandler: Sendable {
157157
}
158158
}
159159

160-
#if compiler(>=6.3)
161-
#warning("Remove sourcekitd_plugin_initialize when we no longer support toolchains that call it")
162-
#endif
163-
164160
/// Legacy plugin initialization logic in which sourcekitd does not inform the plugin about the sourcekitd path it was
165161
/// loaded from.
166162
@_cdecl("sourcekitd_plugin_initialize")
167163
public func sourcekitd_plugin_initialize(_ params: sourcekitd_api_plugin_initialize_params_t) {
168-
#if canImport(Darwin)
169-
var dlInfo = Dl_info()
170-
dladdr(#dsohandle, &dlInfo)
171-
let path = String(cString: dlInfo.dli_fname)
172-
var url = URL(fileURLWithPath: path, isDirectory: false)
173-
while url.pathExtension != "framework" && url.lastPathComponent != "/" {
174-
url.deleteLastPathComponent()
175-
}
176-
url =
177-
url
178-
.deletingLastPathComponent()
179-
.appendingPathComponent("sourcekitd.framework")
180-
.appendingPathComponent("sourcekitd")
181-
if FileManager.default.fileExists(at: url) {
182-
try! url.filePath.withCString { sourcekitdPath in
183-
sourcekitd_plugin_initialize_2(params, sourcekitdPath)
184-
}
185-
} else {
186-
// When using a SourceKit plugin from the build directory, we can't find sourcekitd relative to the plugin.
187-
// Since sourcekitd_plugin_initialize is only called on Darwin from Xcode toolchains, we know that we are getting
188-
// called from an XPC sourcekitd. Thus, all sourcekitd symbols that we need should be loaded in the current process
189-
// already and we can use `RTLD_DEFAULT` for the sourcekitd library.
190-
sourcekitd_plugin_initialize_2(params, "SOURCEKIT_LSP_PLUGIN_PARENT_LIBRARY_RTLD_DEFAULT")
191-
}
192-
#else
193-
fatalError("sourcekitd_plugin_initialize is not supported on non-Darwin platforms")
194-
#endif
164+
fatalError("sourcekitd_plugin_initialize has been removed in favor of sourcekitd_plugin_initialize_2")
195165
}
196166

197167
#if canImport(Darwin)

0 commit comments

Comments
 (0)