Skip to content

Commit 05f9859

Browse files
authored
Merge pull request #1125 from ahoppen/ahoppen/buildserverprotocol-strict-concurrency
Make the `BuildServerProtocol` module build with strict concurrency enabled
2 parents b3d2df7 + aa424d9 commit 05f9859

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

Package.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ let package = Package(
3737
linkerSettings: sourcekitLSPLinkSettings
3838
),
3939

40-
// MARK: BuildServerProtocol:
40+
// MARK: BuildServerProtocol
4141
// Connection between build server and language server to provide build and index info
4242

4343
.target(
4444
name: "BuildServerProtocol",
4545
dependencies: [
4646
"LanguageServerProtocol"
4747
],
48-
exclude: ["CMakeLists.txt"]
48+
exclude: ["CMakeLists.txt"],
49+
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]
4950
),
5051

5152
// MARK: CSKTestSupport

Sources/BuildServerProtocol/BuildTargets.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public struct BuildTargetsResult: ResponseType, Hashable {
2626
public var targets: [BuildTarget]
2727
}
2828

29-
public struct BuildTarget: Codable, Hashable {
29+
public struct BuildTarget: Codable, Hashable, Sendable {
3030
/// The target’s unique identifier
3131
public var id: BuildTargetIdentifier
3232

@@ -81,15 +81,15 @@ public struct BuildTarget: Codable, Hashable {
8181
}
8282
}
8383

84-
public struct BuildTargetIdentifier: Codable, Hashable {
84+
public struct BuildTargetIdentifier: Codable, Hashable, Sendable {
8585
public var uri: URI
8686

8787
public init(uri: URI) {
8888
self.uri = uri
8989
}
9090
}
9191

92-
public struct BuildTargetTag: Codable, Hashable, RawRepresentable {
92+
public struct BuildTargetTag: Codable, Hashable, RawRepresentable, Sendable {
9393
public var rawValue: String
9494

9595
public init(rawValue: String) {
@@ -113,7 +113,7 @@ public struct BuildTargetTag: Codable, Hashable, RawRepresentable {
113113
/// "test" and "integration-test" is that integration tests traditionally run
114114
/// slower compared to normal tests and require more computing resources to
115115
/// execute.
116-
public static let integationTest: Self = Self(rawValue: "integration-test")
116+
public static let integrationTest: Self = Self(rawValue: "integration-test")
117117

118118
/// Target contains source code to measure performance of a program, may have
119119
/// but does not require the `canRun` build target capability.
@@ -123,7 +123,7 @@ public struct BuildTargetTag: Codable, Hashable, RawRepresentable {
123123
public static let noIDE: Self = Self(rawValue: "no-ide")
124124
}
125125

126-
public struct BuildTargetCapabilities: Codable, Hashable {
126+
public struct BuildTargetCapabilities: Codable, Hashable, Sendable {
127127
/// This target can be compiled by the BSP server.
128128
public var canCompile: Bool
129129

@@ -159,14 +159,14 @@ public struct BuildTargetSourcesResult: ResponseType, Hashable {
159159
public var items: [SourcesItem]
160160
}
161161

162-
public struct SourcesItem: Codable, Hashable {
162+
public struct SourcesItem: Codable, Hashable, Sendable {
163163
public var target: BuildTargetIdentifier
164164

165165
/// The text documents and directories that belong to this build target.
166166
public var sources: [SourceItem]
167167
}
168168

169-
public struct SourceItem: Codable, Hashable {
169+
public struct SourceItem: Codable, Hashable, Sendable {
170170
/// Either a text document or a directory. A directory entry must end with a
171171
/// forward slash "/" and a directory entry implies that every nested text
172172
/// document within the directory belongs to this source item.
@@ -180,7 +180,7 @@ public struct SourceItem: Codable, Hashable {
180180
public var generated: Bool
181181
}
182182

183-
public enum SourceItemKind: Int, Codable, Hashable {
183+
public enum SourceItemKind: Int, Codable, Hashable, Sendable {
184184
/// The source item references a normal file.
185185
case file = 1
186186

@@ -205,7 +205,7 @@ public struct BuildTargetOutputPathsResponse: ResponseType, Hashable {
205205
public var items: [OutputsItem]
206206
}
207207

208-
public struct OutputsItem: Codable, Hashable {
208+
public struct OutputsItem: Codable, Hashable, Sendable {
209209
public var target: BuildTargetIdentifier
210210

211211
/// The output paths for sources that belong to this build target.
@@ -225,7 +225,7 @@ public struct BuildTargetsChangedNotification: NotificationType {
225225
}
226226
}
227227

228-
public struct BuildTargetEvent: Codable, Hashable {
228+
public struct BuildTargetEvent: Codable, Hashable, Sendable {
229229
/// The identifier for the changed build target.
230230
public var target: BuildTargetIdentifier
231231

@@ -242,7 +242,7 @@ public struct BuildTargetEvent: Codable, Hashable {
242242
}
243243
}
244244

245-
public enum BuildTargetEventKind: Int, Codable, Hashable {
245+
public enum BuildTargetEventKind: Int, Codable, Hashable, Sendable {
246246
/// The build target is new.
247247
case created = 1
248248

Sources/BuildServerProtocol/InitializeBuild.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public struct InitializeBuild: RequestType, Hashable {
5959
}
6060
}
6161

62-
public struct BuildClientCapabilities: Codable, Hashable {
62+
public struct BuildClientCapabilities: Codable, Hashable, Sendable {
6363
/// The languages that this client supports.
6464
/// The ID strings for each language is defined in the LSP.
6565
/// The server must never respond with build targets for other
@@ -102,7 +102,7 @@ public struct InitializeBuildResult: ResponseType, Hashable {
102102
}
103103
}
104104

105-
public struct BuildServerCapabilities: Codable, Hashable {
105+
public struct BuildServerCapabilities: Codable, Hashable, Sendable {
106106
/// The languages the server supports compilation via method buildTarget/compile.
107107
public var compileProvider: CompileProvider? = nil
108108

@@ -129,23 +129,23 @@ public struct BuildServerCapabilities: Codable, Hashable {
129129
public var buildTargetChangedProvider: Bool? = nil
130130
}
131131

132-
public struct CompileProvider: Codable, Hashable {
132+
public struct CompileProvider: Codable, Hashable, Sendable {
133133
public var languageIds: [Language]
134134

135135
public init(languageIds: [Language]) {
136136
self.languageIds = languageIds
137137
}
138138
}
139139

140-
public struct RunProvider: Codable, Hashable {
140+
public struct RunProvider: Codable, Hashable, Sendable {
141141
public var languageIds: [Language]
142142

143143
public init(languageIds: [Language]) {
144144
self.languageIds = languageIds
145145
}
146146
}
147147

148-
public struct TestProvider: Codable, Hashable {
148+
public struct TestProvider: Codable, Hashable, Sendable {
149149
public var languageIds: [Language]
150150

151151
public init(languageIds: [Language]) {

Sources/BuildServerProtocol/RegisterForChangeNotifications.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public struct RegisterForChanges: RequestType {
3131
}
3232
}
3333

34-
public enum RegisterAction: String, Hashable, Codable {
34+
public enum RegisterAction: String, Hashable, Codable, Sendable {
3535
case register = "register"
3636
case unregister = "unregister"
3737
}

0 commit comments

Comments
 (0)