Skip to content

Commit 42140c5

Browse files
committed
Make SKCore build with strict concurrency
1 parent c753cc4 commit 42140c5

12 files changed

+16
-16
lines changed

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ let package = Package(
178178
.product(name: "SwiftPMDataModel-auto", package: "swift-package-manager"),
179179
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
180180
],
181-
exclude: ["CMakeLists.txt"]
181+
exclude: ["CMakeLists.txt"],
182+
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]
182183
),
183184

184185
.testTarget(

Sources/SKCore/BuildSetup.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
import SKSupport
1414

15-
import struct PackageModel.BuildFlags
15+
@preconcurrency import struct PackageModel.BuildFlags
1616
import struct TSCBasic.AbsolutePath
1717

1818
/// Build configuration
19-
public struct BuildSetup {
19+
public struct BuildSetup: Sendable {
2020

2121
/// Default configuration
2222
public static let `default` = BuildSetup(

Sources/SKCore/BuildSystem.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import LanguageServerProtocol
1616
import struct TSCBasic.AbsolutePath
1717

1818
/// Defines how well a `BuildSystem` can handle a file with a given URI.
19-
public enum FileHandlingCapability: Comparable {
19+
public enum FileHandlingCapability: Comparable, Sendable {
2020
/// The build system can't handle the file at all
2121
case unhandled
2222

@@ -36,7 +36,7 @@ public enum FileHandlingCapability: Comparable {
3636
///
3737
/// For example, a SwiftPMWorkspace provides compiler arguments for the files
3838
/// contained in a SwiftPM package root directory.
39-
public protocol BuildSystem: AnyObject {
39+
public protocol BuildSystem: AnyObject, Sendable {
4040

4141
/// The root of the project that this build system manages. For example, for SwiftPM packages, this is the folder
4242
/// containing Package.swift. For compilation databases it is the root folder based on which the compilation database

Sources/SKCore/BuildSystemDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import BuildServerProtocol
1313
import LanguageServerProtocol
1414

1515
/// Handles build system events, such as file build settings changes.
16-
public protocol BuildSystemDelegate: AnyObject {
16+
public protocol BuildSystemDelegate: AnyObject, Sendable {
1717
/// Notify the delegate that the build targets have changed.
1818
///
1919
/// The callee should request new sources and outputs for the build targets of

Sources/SKCore/CompilationDatabase.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ extension FixedCompilationDatabase {
141141
var fixedArgs: [String] = ["clang"]
142142
try bytes.withUnsafeData { data in
143143
guard let fileContents = String(data: data, encoding: .utf8) else {
144-
throw CompilationDatabaseDecodingError.fixedDatabaseDecordingError
144+
throw CompilationDatabaseDecodingError.fixedDatabaseDecodingError
145145
}
146146

147147
fileContents.enumerateLines { line, _ in
@@ -238,7 +238,7 @@ extension JSONCompilationDatabase {
238238

239239
enum CompilationDatabaseDecodingError: Error {
240240
case missingCommandOrArguments
241-
case fixedDatabaseDecordingError
241+
case fixedDatabaseDecodingError
242242
}
243243

244244
extension CompilationDatabase.Command: Codable {

Sources/SKCore/FallbackBuildSystem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Foundation
1616
import LanguageServerProtocol
1717
import SKSupport
1818

19-
import enum PackageLoading.Platform
19+
@preconcurrency import enum PackageLoading.Platform
2020
import struct TSCBasic.AbsolutePath
2121
import class TSCBasic.Process
2222

Sources/SKCore/FileBuildSettings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import LanguageServerProtocol
1717
///
1818
/// Encapsulates all the settings needed to compile a single file, including the compiler arguments
1919
/// and working directory. FileBuildSettings are typically the result of a BuildSystem query.
20-
public struct FileBuildSettings: Equatable {
20+
public struct FileBuildSettings: Equatable, Sendable {
2121

2222
/// The compiler arguments to use for this file.
2323
public var compilerArguments: [String]

Sources/SKCore/MainFilesProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import LanguageServerProtocol
1414

1515
/// A type that can provide the set of main files that include a particular file.
16-
public protocol MainFilesProvider: AnyObject {
16+
public protocol MainFilesProvider: AnyObject, Sendable {
1717

1818
/// Returns the set of main files that contain the given file.
1919
///

Sources/SKCore/PathPrefixMapping.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
public struct PathPrefixMapping {
3+
public struct PathPrefixMapping: Sendable {
44
/// Path prefix to be replaced, typically the canonical or hermetic path.
55
public let original: String
66

Sources/SKCore/Toolchain.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import LSPLogging
1414
import LanguageServerProtocol
1515
import SKSupport
1616

17-
import enum PackageLoading.Platform
17+
@preconcurrency import enum PackageLoading.Platform
1818
import struct TSCBasic.AbsolutePath
1919
import protocol TSCBasic.FileSystem
2020
import var TSCBasic.localFileSystem
@@ -114,7 +114,6 @@ public final class Toolchain {
114114
}
115115

116116
extension Toolchain {
117-
118117
/// Create a toolchain for the given path, if it contains at least one tool, otherwise return nil.
119118
///
120119
/// This initializer looks for a toolchain using the following basic layout:

0 commit comments

Comments
 (0)