[build-system] Fold ExternalWorkspace into BuildSystem

Simplifies clients to only need to care about one thing, and makes it
easier for BuildSystems to grow new functionality.
This commit is contained in:
Ben Langmuir
2018-12-03 22:54:35 -08:00
parent 63b9b3dbaf
commit 7f74d4a25f
8 changed files with 42 additions and 55 deletions

View File

@@ -17,7 +17,7 @@ import LanguageServerProtocol
///
/// Provides build settings from a `CompilationDatabase` found by searching a project. For now, only
/// one compilation database, located at the project root.
public final class CompilationDatabaseBuildSystem: BuildSystem {
public final class CompilationDatabaseBuildSystem {
/// The compilation database.
var compdb: CompilationDatabase? = nil
@@ -30,6 +30,13 @@ public final class CompilationDatabaseBuildSystem: BuildSystem {
self.compdb = tryLoadCompilationDatabase(directory: path, fileSystem: fileSystem)
}
}
}
extension CompilationDatabaseBuildSystem: BuildSystem {
// FIXME: derive from the compiler arguments.
public var indexStorePath: AbsolutePath? { return nil }
public var indexDatabasePath: AbsolutePath? { return nil }
public func settings(for url: URL, _ language: Language) -> FileBuildSettings? {
guard let db = database(for: url),