Create BuildSystem in BuiltInBuildSystemAdapter

This finalizes the move of `BuiltInBuildSystem` creation into `BuiltInBuildSystemAdapter` and means that we can set the message handler of the `BuiltInBuildSystem` during initialization instead of using a setter method.
This commit is contained in:
Alex Hoppen
2024-08-24 00:37:25 -07:00
parent 9f4088038c
commit ea21175dd7
11 changed files with 115 additions and 93 deletions

View File

@@ -50,10 +50,6 @@ package actor CompilationDatabaseBuildSystem {
package weak var messageHandler: BuiltInBuildSystemMessageHandler?
package func setMessageHandler(_ messageHandler: any BuiltInBuildSystemMessageHandler) {
self.messageHandler = messageHandler
}
package let projectRoot: AbsolutePath
let searchPaths: [RelativePath]
@@ -87,11 +83,13 @@ package actor CompilationDatabaseBuildSystem {
package init?(
projectRoot: AbsolutePath,
searchPaths: [RelativePath],
messageHandler: (any BuiltInBuildSystemMessageHandler)?,
fileSystem: FileSystem = localFileSystem
) {
self.fileSystem = fileSystem
self.projectRoot = projectRoot
self.searchPaths = searchPaths
self.messageHandler = messageHandler
if let compdb = tryLoadCompilationDatabase(directory: projectRoot, additionalSearchPaths: searchPaths, fileSystem) {
self.compdb = compdb
} else {