Introduce a notion of ConfiguredTargets into the build system

Instead of asking for build settings of a file, the build system manager asks for the targets of a file and then asks for the build settings of that file in a specific target. This has two advantages:
- We know about targets and can prepare the targets for background indexing
- Once we support build systems in which a single file can be part of multiple targets, we can have a centralized place that picks preferred targets for a file, eg. based on user configuration
This commit is contained in:
Alex Hoppen
2024-05-08 16:02:11 -07:00
parent a643749def
commit d4dd57861c
9 changed files with 175 additions and 55 deletions

View File

@@ -263,7 +263,11 @@ extension BuildServerBuildSystem: BuildSystem {
///
/// Returns `nil` if no build settings have been received from the build
/// server yet or if no build settings are available for this file.
public func buildSettings(for document: DocumentURI, language: Language) async -> FileBuildSettings? {
public func buildSettings(
for document: DocumentURI,
in target: ConfiguredTarget,
language: Language
) async -> FileBuildSettings? {
return buildSettings[document]
}
@@ -271,6 +275,10 @@ extension BuildServerBuildSystem: BuildSystem {
return nil
}
public func configuredTargets(for document: DocumentURI) async -> [ConfiguredTarget] {
return [ConfiguredTarget(targetID: "dummy", runDestinationID: "dummy")]
}
public func registerForChangeNotifications(for uri: DocumentURI) {
let request = RegisterForChanges(uri: uri, action: .register)
_ = self.buildServer?.send(request) { result in