Skip to content

Commit

Permalink
Remove indexPrefixMappings from BuildSystem
Browse files Browse the repository at this point in the history
They weren’t used.
  • Loading branch information
ahoppen committed Jul 17, 2024
1 parent ef2dc17 commit 43a75e5
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 18 deletions.
3 changes: 0 additions & 3 deletions Sources/SKCore/BuildServerBuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ public actor BuildServerBuildSystem: MessageHandler {
public private(set) var indexDatabasePath: AbsolutePath?
public private(set) var indexStorePath: AbsolutePath?

// FIXME: Add support for prefix mappings to the Build Server protocol.
public var indexPrefixMappings: [PathPrefixMapping] { return [] }

/// Delegate to handle any build system events.
public weak var delegate: BuildSystemDelegate?

Expand Down
3 changes: 0 additions & 3 deletions Sources/SKCore/BuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ public protocol BuildSystem: AnyObject, Sendable {
/// The path to put the index database, if any.
var indexDatabasePath: AbsolutePath? { get async }

/// Path remappings for remapping index data for local use.
var indexPrefixMappings: [PathPrefixMapping] { get async }

/// Delegate to handle any build system events such as file build settings initial reports as well as changes.
///
/// The build system must not retain the delegate because the delegate can be the `BuildSystemManager`, which could
Expand Down
2 changes: 0 additions & 2 deletions Sources/SKCore/CompilationDatabaseBuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ extension CompilationDatabaseBuildSystem: BuildSystem {
indexStorePath?.parentDirectory.appending(component: "IndexDatabase")
}

public var indexPrefixMappings: [PathPrefixMapping] { return [] }

public func buildSettings(
for document: DocumentURI,
in buildTarget: ConfiguredTarget,
Expand Down
2 changes: 0 additions & 2 deletions Sources/SKCore/FallbackBuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public actor FallbackBuildSystem {

public var indexDatabasePath: AbsolutePath? { return nil }

public var indexPrefixMappings: [PathPrefixMapping] { return [] }

public func buildSettings(for uri: DocumentURI, language: Language) -> FileBuildSettings? {
var fileBuildSettings: FileBuildSettings?
switch language {
Expand Down
2 changes: 0 additions & 2 deletions Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,6 @@ extension SwiftPMBuildSystem: SKCore.BuildSystem {
return buildPath.appending(components: "index", "db")
}

public var indexPrefixMappings: [PathPrefixMapping] { return [] }

/// Return the compiler arguments for the given source file within a target, making any necessary adjustments to
/// account for differences in the SwiftPM versions being linked into SwiftPM and being installed in the toolchain.
private func compilerArguments(for file: DocumentURI, in buildTarget: any SwiftBuildTarget) async throws -> [String] {
Expand Down
5 changes: 1 addition & 4 deletions Sources/SourceKitLSP/Workspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,7 @@ public final class Workspace: Sendable {
let lib = try IndexStoreLibrary(dylibPath: libPath.pathString)
indexDelegate = SourceKitIndexDelegate()
let prefixMappings =
await firstNonNil(
indexOptions.indexPrefixMap?.map { PathPrefixMapping(original: $0.key, replacement: $0.value) },
await buildSystem?.indexPrefixMappings
) ?? []
indexOptions.indexPrefixMap?.map { PathPrefixMapping(original: $0.key, replacement: $0.value) } ?? []
index = try IndexStoreDB(
storePath: storePath.pathString,
databasePath: dbPath.pathString,
Expand Down
1 change: 0 additions & 1 deletion Tests/SKCoreTests/BuildSystemManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ class ManualBuildSystem: BuildSystem {

var indexStorePath: AbsolutePath? { nil }
var indexDatabasePath: AbsolutePath? { nil }
var indexPrefixMappings: [PathPrefixMapping] { return [] }

func filesDidChange(_ events: [FileEvent]) {}

Expand Down
1 change: 0 additions & 1 deletion Tests/SourceKitLSPTests/BuildSystemTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ actor TestBuildSystem: BuildSystem {
let projectRoot: AbsolutePath = try! AbsolutePath(validating: "/")
let indexStorePath: AbsolutePath? = nil
let indexDatabasePath: AbsolutePath? = nil
let indexPrefixMappings: [PathPrefixMapping] = []

weak var delegate: BuildSystemDelegate?

Expand Down

0 comments on commit 43a75e5

Please sign in to comment.