Skip to content

Commit a534385

Browse files
committed
Add option to skip building and running plugins
This *shouldn't* be needed, but allows running plugins to be skipped if there's any unexpected interactions with background indexing.
1 parent cea30e5 commit a534385

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
355355
// We have a whole separate arena if we're performing background indexing. This allows us to also build and run
356356
// plugins, without having to worry about messing up any regular build state.
357357
let buildDescription: SourceKitLSPAPI.BuildDescription
358-
if isForIndexBuild {
358+
if isForIndexBuild && !(options.swiftPMOrDefault.skipPlugins ?? false) {
359359
let loaded = try await BuildDescription.load(
360360
destinationBuildParameters: destinationBuildParameters,
361361
toolsBuildParameters: toolsBuildParameters,

Sources/SKOptions/SourceKitLSPOptions.swift

+10-2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ public struct SourceKitLSPOptions: Sendable, Codable, Equatable {
7676
/// Useful when running `sourcekit-lsp` in a sandbox because nested sandboxes are not supported.
7777
public var disableSandbox: Bool?
7878

79+
/// Whether to skip building and running plugins when creating the in-memory build graph.
80+
///
81+
/// - Note: Internal option, only exists as an escape hatch in case this causes unintentional interactions with
82+
/// background indexing.
83+
public var skipPlugins: Bool?
84+
7985
public init(
8086
configuration: BuildConfiguration? = nil,
8187
scratchPath: String? = nil,
@@ -88,7 +94,8 @@ public struct SourceKitLSPOptions: Sendable, Codable, Equatable {
8894
swiftCompilerFlags: [String]? = nil,
8995
linkerFlags: [String]? = nil,
9096
buildToolsSwiftCompilerFlags: [String]? = nil,
91-
disableSandbox: Bool? = nil
97+
disableSandbox: Bool? = nil,
98+
skipPlugins: Bool? = nil
9299
) {
93100
self.configuration = configuration
94101
self.scratchPath = scratchPath
@@ -117,7 +124,8 @@ public struct SourceKitLSPOptions: Sendable, Codable, Equatable {
117124
swiftCompilerFlags: override?.swiftCompilerFlags ?? base.swiftCompilerFlags,
118125
linkerFlags: override?.linkerFlags ?? base.linkerFlags,
119126
buildToolsSwiftCompilerFlags: override?.buildToolsSwiftCompilerFlags ?? base.buildToolsSwiftCompilerFlags,
120-
disableSandbox: override?.disableSandbox ?? base.disableSandbox
127+
disableSandbox: override?.disableSandbox ?? base.disableSandbox,
128+
skipPlugins: override?.skipPlugins ?? base.skipPlugins
121129
)
122130
}
123131
}

0 commit comments

Comments
 (0)