Make BuildSystemKind a struct and rename to BuildSystemSpec

This commit is contained in:
Alex Hoppen
2024-11-13 10:23:43 -08:00
parent c1e090ef33
commit 0fbb6466e7
8 changed files with 71 additions and 62 deletions

View File

@@ -35,7 +35,7 @@ import struct TSCBasic.AbsolutePath
package func determineBuildSystem(
forWorkspaceFolder workspaceFolder: DocumentURI,
options: SourceKitLSPOptions
) -> BuildSystemKind? {
) -> BuildSystemSpec? {
var buildSystemPreference: [WorkspaceType] = [
.buildServer, .swiftPM, .compilationDatabase,
]
@@ -52,17 +52,17 @@ package func determineBuildSystem(
switch buildSystemType {
case .buildServer:
if let projectRoot = ExternalBuildSystemAdapter.projectRoot(for: workspaceFolderPath, options: options) {
return .buildServer(projectRoot: projectRoot)
return BuildSystemSpec(kind: .buildServer, projectRoot: projectRoot)
}
case .compilationDatabase:
if let projectRoot = CompilationDatabaseBuildSystem.projectRoot(for: workspaceFolderPath, options: options) {
return .compilationDatabase(projectRoot: projectRoot)
return BuildSystemSpec(kind: .compilationDatabase, projectRoot: projectRoot)
}
case .swiftPM:
if let projectRootURL = SwiftPMBuildSystem.projectRoot(for: workspaceFolderUrl, options: options),
let projectRoot = try? AbsolutePath(validating: projectRootURL.filePath)
{
return .swiftPM(projectRoot: projectRoot)
return BuildSystemSpec(kind: .swiftPM, projectRoot: projectRoot)
}
}
}