Merge pull request #179 from rmaz/indexdbpath

Set index db path from build server response
This commit is contained in:
Ben Langmuir
2019-10-30 16:10:29 -07:00
committed by GitHub
3 changed files with 7 additions and 4 deletions

View File

@@ -31,6 +31,8 @@ public final class BuildServerBuildSystem {
var handler: BuildServerHandler?
var buildServer: JSONRPCConection?
public private(set) var indexDatabasePath: AbsolutePath?
public private(set) var indexStorePath: AbsolutePath?
/// Delegate to handle any build system events.
@@ -104,6 +106,9 @@ public final class BuildServerBuildSystem {
log("initialized build server \(response.displayName)")
// see if index store was set as part of the server metadata
if let indexDbPath = readReponseDataKey(data: response.data, key: "indexDatabasePath") {
self.indexDatabasePath = AbsolutePath(indexDbPath, relativeTo: self.projectRoot)
}
if let indexStorePath = readReponseDataKey(data: response.data, key: "indexStorePath") {
self.indexStorePath = AbsolutePath(indexStorePath, relativeTo: self.projectRoot)
}
@@ -164,10 +169,6 @@ extension BuildServerBuildSystem: BuildSystem {
})
}
public var indexDatabasePath: AbsolutePath? {
return buildFolder?.appending(components: "index", "db")
}
public func settings(for url: URL, _ language: Language) -> FileBuildSettings? {
if let response = try? self.buildServer?.sendSync(SourceKitOptions(uri: url)) {
return FileBuildSettings(compilerArguments: response.options, workingDirectory: response.workingDirectory)