Skip to content

Commit 38bbd8d

Browse files
committed
Rename build system to build server in most cases
The term *build system* predated our wide-spread adoption of BSP for communicating between SourceKit-LSP to the build system and was never really the correct term anyway – ie. a `JSONCompilationDatabaseBuildSystem` never really sounded right. We now have a correct term for the communication layer between SourceKit-LSP: A build server. Rename most occurrences of *build system* to *build server* to reflect this. There are unfortunately a couple lingering instances of *build system* that we can’t change, most notably: `fallbackBuildSystem` in the config file, the `workspace/waitForBuildSystemUpdates` BSP extension request and the `synchronize-for-build-system-updates` experimental feature.
1 parent d2e5bd7 commit 38bbd8d

File tree

88 files changed

+836
-816
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+836
-816
lines changed

.vscode/launch.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"program": "${workspaceFolder:sourcekit-lsp}/.build/debug/sourcekit-lsp",
88
"args": [],
99
"cwd": "${workspaceFolder:sourcekit-lsp}",
10-
"preLaunchTask": "swift: Build Debug sourcekit-lsp",
10+
"preLaunchTask": "swift: Build Debug sourcekit-lsp"
1111
},
1212
{
1313
"type": "swift",
@@ -16,14 +16,32 @@
1616
"program": "${workspaceFolder:sourcekit-lsp}/.build/release/sourcekit-lsp",
1717
"args": [],
1818
"cwd": "${workspaceFolder:sourcekit-lsp}",
19-
"preLaunchTask": "swift: Build Release sourcekit-lsp",
19+
"preLaunchTask": "swift: Build Release sourcekit-lsp"
2020
},
2121
{
2222
"type": "swift",
2323
"request": "attach",
2424
"name": "Attach sourcekit-lsp (debug)",
2525
"program": "${workspaceFolder:sourcekit-lsp}/.build/debug/sourcekit-lsp",
2626
"waitFor": true
27+
},
28+
{
29+
"type": "swift",
30+
"request": "launch",
31+
"args": [],
32+
"cwd": "${workspaceFolder:sourcekit-lsp}/SourceKitLSPDevUtils",
33+
"name": "Debug sourcekit-lsp-dev-utils (SourceKitLSPDevUtils)",
34+
"program": "${workspaceFolder:sourcekit-lsp}/SourceKitLSPDevUtils/.build/debug/sourcekit-lsp-dev-utils",
35+
"preLaunchTask": "swift: Build Debug sourcekit-lsp-dev-utils (SourceKitLSPDevUtils)"
36+
},
37+
{
38+
"type": "swift",
39+
"request": "launch",
40+
"args": [],
41+
"cwd": "${workspaceFolder:sourcekit-lsp}/SourceKitLSPDevUtils",
42+
"name": "Release sourcekit-lsp-dev-utils (SourceKitLSPDevUtils)",
43+
"program": "${workspaceFolder:sourcekit-lsp}/SourceKitLSPDevUtils/.build/release/sourcekit-lsp-dev-utils",
44+
"preLaunchTask": "swift: Build Release sourcekit-lsp-dev-utils (SourceKitLSPDevUtils)"
2745
}
2846
]
2947
}

Contributor Documentation/BSP Extensions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export interface SourceKitSourceItemData {
7878
/** The language of the source file. If `nil`, the language is inferred from the file extension. */
7979
language?: LanguageId;
8080

81-
/**
81+
/**
8282
* The kind of source file that this source item represents. If omitted, the item is assumed to be a normal source
8383
* file, ie. omitting this key is equivalent to specifying it as `source`.
8484
*/
@@ -172,7 +172,7 @@ export interface SourceKitBuildTarget {
172172

173173
## `workspace/didChangeWatchedFiles`
174174

175-
Notification sent from SourceKit-LSP to the build system to indicate that files within the project have been modified.
175+
Notification sent from SourceKit-LSP to the build server to indicate that files within the project have been modified.
176176

177177
SourceKit-LSP may send file change notifications for a superset of the files that the BSP server requested to watch in `watchers`. It is the BSP server’s responsibility to filter the file watch notifications for the ones it is actually interested in.
178178

@@ -182,6 +182,6 @@ Definition is the same as in LSP.
182182

183183
This request is a no-op and doesn't have any effects.
184184

185-
If the build system is currently updating the build graph, this request should return after those updates have finished processing.
185+
If the build server is currently updating the build graph, this request should return after those updates have finished processing.
186186

187187
- method: `workspace/waitForBuildSystemUpdates`

Contributor Documentation/Background Indexing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ Preparation of a target should perform the minimal amount of work to build all `
1212

1313
### Status tracking
1414

15-
When SourceKit-LSP is launched, all targets are considered to be out-of-date. This needs to be done because source files might have changed since SourceKit-LSP was last started – if the module wasn’t modified since the last SourceKit-LSP launch, we re-prepare the target and rely on the build system to produce a fast null build.
15+
When SourceKit-LSP is launched, all targets are considered to be out-of-date. This needs to be done because source files might have changed since SourceKit-LSP was last started – if the module wasn’t modified since the last SourceKit-LSP launch, we re-prepare the target and rely on the build server to produce a fast null build.
1616

17-
After we have prepared a target, we mark it as being up-to-date in `SemanticIndexManager.preparationUpToDateTracker`. That way we don’t need to invoke the build system every time we want to perform semantic functionality of a source file, which saves us the time of a null build (which can hundreds of milliseconds for SwiftPM). If a source file is changed (as noted through file watching), all of its target’s dependencies are marked as out-of-date. Note that the target that the source file belongs to is not marked as out-of-date – preparation of a target builds all dependencies but does not need to build the target’s module itself. The next operation that requires the target to be prepared will trigger a preparation job.
17+
After we have prepared a target, we mark it as being up-to-date in `SemanticIndexManager.preparationUpToDateTracker`. That way we don’t need to invoke the build server every time we want to perform semantic functionality of a source file, which saves us the time of a null build (which can hundreds of milliseconds for SwiftPM). If a source file is changed (as noted through file watching), all of its target’s dependencies are marked as out-of-date. Note that the target that the source file belongs to is not marked as out-of-date – preparation of a target builds all dependencies but does not need to build the target’s module itself. The next operation that requires the target to be prepared will trigger a preparation job.
1818

1919
## Updating the index store
2020

Contributor Documentation/Implementing a BSP server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ If the build system loads the entire build graph during initialization, it may i
2929

3030
## Supporting background indexing
3131

32-
To support background indexing, the build system must set `data.prepareProvider: true` in the `build/initialize` response and implement the `buildTarget/prepare` method. The compiler options used to prepare a target should match those sent for `textDocument/sourceKitOptions` in order to avoid mismatches when loading modules.
32+
To support background indexing, the build server must set `data.prepareProvider: true` in the `build/initialize` response and implement the `buildTarget/prepare` method. The compiler options used to prepare a target should match those sent for `textDocument/sourceKitOptions` in order to avoid mismatches when loading modules.
3333

3434
## Optional methods
3535

Contributor Documentation/LSP Extensions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ export interface SourceKitOptionsRequest {
611611
* If set to `true` and build settings could not be determined within a timeout (see `buildSettingsTimeout` in the
612612
* SourceKit-LSP configuration file), this request returns fallback build settings.
613613
*
614-
* If set to `true` the request only finishes when build settings were provided by the build system.
614+
* If set to `true` the request only finishes when build settings were provided by the build server.
615615
*/
616616
allowFallbackSettings: bool
617617
}

Contributor Documentation/Modules.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ The SourceKit-LSP package contains the following non-testing modules.
66

77
Swift types to represent the [Build Server Protocol (BSP) specification](https://build-server-protocol.github.io/docs/specification). These types should also be usable when implementing a BSP client and thus this module should not have any dependencies other than the LanguageServerProtocol module, with which it shares some types.
88

9-
### BuildSystemIntegration
9+
### BuildServerIntegration
1010

11-
Defines the queries SourceKit-LSP can ask of a build system, like getting compiler arguments for a file, finding a target’s dependencies or preparing a target.
11+
Defines the queries SourceKit-LSP can ask of a build server, like getting compiler arguments for a file, finding a target’s dependencies or preparing a target.
1212

1313
### CAtomics
1414

Contributor Documentation/Overview.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ For requests that require knowledge about the project’s index, like call hiera
1818

1919
[sourcekitd](https://github.com/apple/swift/tree/main/tools/SourceKit) is implemented in the Swift compiler’s repository and uses the Swift compiler’s understanding of Swift code to provide semantic functionality. On macOS, sourcekitd is run as an XPC service and all other platforms sourcekitd is run in the sourcekit-lsp process. This means that on macOS, a crash of sourcekitd can be recovered by re-launching sourcekitd, while on other platforms a crash inside sourcekitd crashes sourcekit-lsp.
2020

21-
## Build systems
21+
## Build servers
2222

23-
Basically all semantic functionality requires knowledge about how a file is being built (like module search paths to be able to resolve `import` statements). SourceKit-LSP consults a `BuildSystem` to get this information. Note that the term build system has a somewhat loose definition in SourceKit-LSP. It’s less about building the project and more about providing information that would be used if building the project. Build systems that are currently supported are:
24-
- `SwiftPMBuildSystem`: Reads a `Package.swift` at the project’s root
25-
- `CompilationDatabaseBuildSystem`: Reads a `compile_commands.json` file to provide build settings for files. `compile_commands.json` can eg. be generated by CMake.
26-
- `BuildServerBuildSystem`: Launches an external build server process to provide build settings.
23+
Basically all semantic functionality requires knowledge about how a file is being built (like module search paths to be able to resolve `import` statements). SourceKit-LSP consults a *build server* to get this information. Build servers that are currently supported are:
24+
- `SwiftPMBuildServer`: Reads a `Package.swift` at the project’s root
25+
- `CompilationDatabaseBuildServer`: Reads a `compile_commands.json` file to provide build settings for files. `compile_commands.json` can eg. be generated by CMake.
26+
- `ExternalBuildServerAdapter`: Launches an external BSP server process to provide build settings.
2727

2828
## Logging
2929

Documentation/Configuration File.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ The structure of the file is currently not guaranteed to be stable. Options may
3030
- `disableSandbox: boolean`: Disables running subprocesses from SwiftPM in a sandbox. Equivalent to SwiftPM's `--disable-sandbox` option. Useful when running `sourcekit-lsp` in a sandbox because nested sandboxes are not supported.
3131
- `compilationDatabase`: Dictionary with the following keys, defining options for workspaces with a compilation database.
3232
- `searchPaths: string[]`: Additional paths to search for a compilation database, relative to a workspace root.
33-
- `fallbackBuildSystem`: Dictionary with the following keys, defining options for files that aren't managed by any build system.
33+
- `fallbackBuildSystem`: Dictionary with the following keys, defining options for files that aren't managed by any build server.
3434
- `cCompilerFlags: string[]`: Extra arguments passed to the compiler for C files.
3535
- `cxxCompilerFlags: string[]`: Extra arguments passed to the compiler for C++ files.
3636
- `swiftCompilerFlags: string[]`: Extra arguments passed to the compiler for Swift files.
3737
- `sdk: string`: The SDK to use for fallback arguments. Default is to infer the SDK using `xcrun`.
38-
- `buildSettingsTimeout: integer`: Number of milliseconds to wait for build settings from the build system before using fallback build settings.
38+
- `buildSettingsTimeout: integer`: Number of milliseconds to wait for build settings from the build server before using fallback build settings.
3939
- `clangdOptions: string[]`: Extra command line arguments passed to `clangd` when launching it.
4040
- `index`: Options related to indexing.
4141
- `indexPrefixMap: [string: string]`: Path remappings for remapping index data for local use.

Package.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var targets: [Target] = [
3737
.executableTarget(
3838
name: "sourcekit-lsp",
3939
dependencies: [
40-
"BuildSystemIntegration",
40+
"BuildServerIntegration",
4141
"Diagnose",
4242
"LanguageServerProtocol",
4343
"LanguageServerProtocolExtensions",
@@ -74,10 +74,10 @@ var targets: [Target] = [
7474
swiftSettings: globalSwiftSettings
7575
),
7676

77-
// MARK: BuildSystemIntegration
77+
// MARK: BuildServerIntegration
7878

7979
.target(
80-
name: "BuildSystemIntegration",
80+
name: "BuildServerIntegration",
8181
dependencies: [
8282
"BuildServerProtocol",
8383
"LanguageServerProtocol",
@@ -101,9 +101,9 @@ var targets: [Target] = [
101101
),
102102

103103
.testTarget(
104-
name: "BuildSystemIntegrationTests",
104+
name: "BuildServerIntegrationTests",
105105
dependencies: [
106-
"BuildSystemIntegration",
106+
"BuildServerIntegration",
107107
"LanguageServerProtocol",
108108
"SKOptions",
109109
"SKTestSupport",
@@ -183,7 +183,7 @@ var targets: [Target] = [
183183
.target(
184184
name: "Diagnose",
185185
dependencies: [
186-
"BuildSystemIntegration",
186+
"BuildServerIntegration",
187187
"InProcessClient",
188188
"LanguageServerProtocolExtensions",
189189
"SKLogging",
@@ -204,7 +204,7 @@ var targets: [Target] = [
204204
.testTarget(
205205
name: "DiagnoseTests",
206206
dependencies: [
207-
"BuildSystemIntegration",
207+
"BuildServerIntegration",
208208
"Diagnose",
209209
"SKLogging",
210210
"SKTestSupport",
@@ -221,7 +221,7 @@ var targets: [Target] = [
221221
name: "DocCDocumentation",
222222
dependencies: [
223223
"BuildServerProtocol",
224-
"BuildSystemIntegration",
224+
"BuildServerIntegration",
225225
"LanguageServerProtocol",
226226
"SemanticIndex",
227227
"SKLogging",
@@ -239,7 +239,7 @@ var targets: [Target] = [
239239
.target(
240240
name: "InProcessClient",
241241
dependencies: [
242-
"BuildSystemIntegration",
242+
"BuildServerIntegration",
243243
"LanguageServerProtocol",
244244
"SKLogging",
245245
"SKOptions",
@@ -313,7 +313,7 @@ var targets: [Target] = [
313313
name: "SemanticIndex",
314314
dependencies: [
315315
"BuildServerProtocol",
316-
"BuildSystemIntegration",
316+
"BuildServerIntegration",
317317
"LanguageServerProtocol",
318318
"LanguageServerProtocolExtensions",
319319
"SKLogging",
@@ -428,7 +428,7 @@ var targets: [Target] = [
428428
.target(
429429
name: "SKTestSupport",
430430
dependencies: [
431-
"BuildSystemIntegration",
431+
"BuildServerIntegration",
432432
"CSKTestSupport",
433433
"Csourcekitd",
434434
"InProcessClient",
@@ -481,7 +481,7 @@ var targets: [Target] = [
481481
.testTarget(
482482
name: "SourceKitDTests",
483483
dependencies: [
484-
"BuildSystemIntegration",
484+
"BuildServerIntegration",
485485
"SourceKitD",
486486
"SKTestSupport",
487487
"SwiftExtensions",
@@ -496,7 +496,7 @@ var targets: [Target] = [
496496
name: "SourceKitLSP",
497497
dependencies: [
498498
"BuildServerProtocol",
499-
"BuildSystemIntegration",
499+
"BuildServerIntegration",
500500
"DocCDocumentation",
501501
"LanguageServerProtocol",
502502
"LanguageServerProtocolExtensions",
@@ -529,7 +529,7 @@ var targets: [Target] = [
529529
name: "SourceKitLSPTests",
530530
dependencies: [
531531
"BuildServerProtocol",
532-
"BuildSystemIntegration",
532+
"BuildServerIntegration",
533533
"LanguageServerProtocol",
534534
"LanguageServerProtocolExtensions",
535535
"SemanticIndex",
@@ -643,7 +643,7 @@ var targets: [Target] = [
643643
.testTarget(
644644
name: "SwiftSourceKitPluginTests",
645645
dependencies: [
646-
"BuildSystemIntegration",
646+
"BuildServerIntegration",
647647
"CompletionScoring",
648648
"Csourcekitd",
649649
"LanguageServerProtocol",

Sources/BuildSystemIntegration/BuildSystemHooks.swift renamed to Sources/BuildServerIntegration/BuildServerHooks.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ package struct SwiftPMTestHooks: Sendable {
2626
}
2727
}
2828

29-
package struct BuildSystemHooks: Sendable {
29+
package struct BuildServerHooks: Sendable {
3030
package var swiftPMTestHooks: SwiftPMTestHooks
3131

32-
/// A hook that will be executed before a request is handled by a `BuiltInBuildSystem`.
32+
/// A hook that will be executed before a request is handled by a `BuiltInBuildServer`.
3333
///
3434
/// This allows requests to be artificially delayed.
3535
package var preHandleRequest: (@Sendable (any RequestType) async -> Void)?
3636

3737
/// When running SourceKit-LSP in-process, allows the creator of `SourceKitLSPServer` to create a message handler that
38-
/// handles BSP requests instead of SourceKit-LSP creating build systems as needed.
38+
/// handles BSP requests instead of SourceKit-LSP creating build server as needed.
3939
package var injectBuildServer:
4040
(@Sendable (_ projectRoot: URL, _ connectionToSourceKitLSP: any Connection) async -> any Connection)?
4141

0 commit comments

Comments
 (0)