Use URL in many cases where we used AbsolutePath

We made quite a few fixes recently to make sure that path handling works correctly using `URL` on Windows. Use `URL` in most places to have a single type that represents file paths instead of sometimes using `AbsolutePath`.

While doing so, also remove usages of `TSCBasic.FileSystem` an `InMemoryFileSystem`. The pattern of using `InMemoryFileSystem` for tests was never consistently used and it was a little confusing that some types took a `FileSystem` parameter while other always assumed to work on the local file system.
This commit is contained in:
Alex Hoppen
2024-11-18 13:10:01 -08:00
parent bce09932ed
commit be546308ca
52 changed files with 1211 additions and 1097 deletions

View File

@@ -20,13 +20,6 @@ import SKOptions
import SwiftExtensions
import ToolchainRegistry
import struct TSCBasic.AbsolutePath
import protocol TSCBasic.FileSystem
import struct TSCBasic.FileSystemError
import func TSCBasic.getEnvSearchPaths
import var TSCBasic.localFileSystem
import func TSCBasic.lookupExecutablePath
#if compiler(>=6.3)
#warning("We have had a one year transition period to the pull based build server. Consider removing this build server")
#endif
@@ -53,12 +46,12 @@ actor LegacyBuildServerBuildSystem: MessageHandler, BuiltInBuildSystem {
/// execution of tasks.
private let bspMessageHandlingQueue = AsyncQueue<Serial>()
package let projectRoot: AbsolutePath
package let projectRoot: URL
var fileWatchers: [FileSystemWatcher] = []
let indexDatabasePath: AbsolutePath?
let indexStorePath: AbsolutePath?
let indexDatabasePath: URL?
let indexStorePath: URL?
package let connectionToSourceKitLSP: LocalConnection
@@ -69,7 +62,7 @@ actor LegacyBuildServerBuildSystem: MessageHandler, BuiltInBuildSystem {
private var urisRegisteredForChanges: Set<URI> = []
init(
projectRoot: AbsolutePath,
projectRoot: URL,
initializationData: InitializeBuildResponse,
_ externalBuildSystemAdapter: ExternalBuildSystemAdapter
) async {
@@ -163,7 +156,7 @@ actor LegacyBuildServerBuildSystem: MessageHandler, BuiltInBuildSystem {
return BuildTargetSourcesResponse(items: [
SourcesItem(
target: .dummy,
sources: [SourceItem(uri: DocumentURI(self.projectRoot.asURL), kind: .directory, generated: false)]
sources: [SourceItem(uri: DocumentURI(self.projectRoot), kind: .directory, generated: false)]
)
])
}