Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove indexPrefixMappings from BuildSystem #1570

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Sources/BuildSystemIntegration/BuildServerBuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ package actor BuildServerBuildSystem: MessageHandler {
package private(set) var indexDatabasePath: AbsolutePath?
package private(set) var indexStorePath: AbsolutePath?

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

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

Expand Down
3 changes: 0 additions & 3 deletions Sources/BuildSystemIntegration/BuildSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ package 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
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ extension CompilationDatabaseBuildSystem: BuildSystem {
indexStorePath?.parentDirectory.appending(component: "IndexDatabase")
}

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

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

package var indexDatabasePath: AbsolutePath? { return nil }

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

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

package 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 @@ -178,10 +178,7 @@ package 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
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,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 @@ -27,7 +27,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