Commit Graph

30 Commits

Author SHA1 Message Date
Alex Hoppen
794d4936fe Revert "Use fallback build settings if build system doesn’t provide build settings within a timeout"
This reverts commit 78217ec6a6.
2024-09-27 12:32:47 -07:00
Alex Hoppen
78217ec6a6 Use fallback build settings if build system doesn’t provide build settings within a timeout
When we receive build settings after hitting the timeout, we call `fileBuildSettingsChanged` on the delegate, which should cause the document to get re-opened in sourcekitd and diagnostics to get refreshed.

rdar://136332685
2024-09-26 17:50:58 -07:00
Alex Hoppen
1fd700b810 Expose all BSP messages used by SourceKit-LSP to BSP servers
The interaction to an out-of-process BSP server still went through the `BuildServerBuildSystem`, which doesn’t forward all messages to the build system and uses the old push-based model for build settings.

If we discover that the BSP server supports the new pull-based build settings model, we now forward all methods to it directly, without going through `BuiltInBuildSystemAdapter`, which has been renamed to `LegacyBuildServerBuildSystem`.

rdar://136106323
rdar://127606323
rdar://126493405
Fixes #1226
Fixes #1173
2024-09-24 22:47:07 -07:00
Alex Hoppen
5202a8fc1c Add test cases that launch a SourceKitLSP server using a BSP server 2024-09-20 17:15:34 -07:00
Alex Hoppen
e15bdd7e90 Review SwiftPMBuildSystem.swift 2024-09-16 10:13:20 -07:00
Alex Hoppen
0bdbb507c9 Review CompilationDatabaseBuildSystem 2024-09-16 10:12:58 -07:00
Alex Hoppen
5996e56010 Review BuiltInBuildSystemAdapter 2024-09-16 10:12:26 -07:00
Alex Hoppen
9ee7c59c7d Minor cleanups 2024-09-16 10:10:26 -07:00
Alex Hoppen
2f388b988a Send shutdown request to build system from BuildSystemManager 2024-09-16 10:10:26 -07:00
Alex Hoppen
85b2f1fd30 Review BuildServerProtocol module for consistency 2024-09-16 10:10:26 -07:00
Alex Hoppen
5870ad9eb4 Implement InverseSourcesRequest in BuildSystemManager
`buildTarget/inverseSources` is not required to be implemented by BSP servers and we have almost all information needed for it in `BuildSystemManager`.

This also makes sure that `buildTarget/sources` and `buildTarget/inverseSources` actually match each other. Before this change, we had source files like `Package.swift` for which we returned a target from `buildTarget/inverseSources` but that weren’t part of that target’s sources retrieved using `buildTarget/sources`.
2024-09-16 10:08:14 -07:00
Alex Hoppen
14e96311ed Fix issue that created incorrect display name for BSP server 2024-09-16 10:08:14 -07:00
Alex Hoppen
f741b0dd41 Use more fine-grained dependency tracking to allow BSP requests to be handled concurrently 2024-09-16 10:06:35 -07:00
Alex Hoppen
8ac405cb19 Make BuildSystemManager.buildSystem and BuiltInBuildSystemAdapter.underlyingBuildSystem private 2024-09-16 10:06:35 -07:00
Alex Hoppen
c93f193d21 Share message handling logic between BuiltInBuildSystemAdapter and BuildSystemManager 2024-09-15 16:28:12 -07:00
Alex Hoppen
6cc2cc4e95 Implement reloadPackageStatusCallback using BSP messages 2024-09-15 16:28:12 -07:00
Alex Hoppen
66f24e3554 Introduce buildSystemTestHooks 2024-09-15 16:28:12 -07:00
Alex Hoppen
3d95375043 Use a LocalConnection to communicate between BuildSystemManager and BuildSystem 2024-09-15 16:28:12 -07:00
Alex Hoppen
fac21f5976 Implement waitForUpToDateBuildGraph using BSP 2024-09-13 11:12:40 -07:00
Alex Hoppen
9006ab6fc8 Use the InitializeRequest from BSP to communicate some static options between the build system and BuildSystemManager 2024-09-12 07:34:12 -07:00
Alex Hoppen
c5ba9671f0 Migrate getting the list of all source files to BSP 2024-09-11 13:42:01 -07:00
Alex Hoppen
3a118980b4 Migrate BuildSystem.prepare to a BSP request 2024-09-11 09:48:50 -07:00
Alex Hoppen
e083124ca5 Merge pull request #1655 from ahoppen/bsp-settings
Use BSP requests to get build settings of a source file
2024-09-10 16:27:23 -07:00
Alex Hoppen
f9e468ffba Use BSP requests to get build settings of a source file 2024-09-10 09:30:36 -07:00
Alex Hoppen
9e98c48c75 Fix retain cycle between BuiltInBuildSystemAdapter and BuiltInBuildSystemAdapterDelegate
This was causing memory leaks.
2024-09-10 06:39:36 -07:00
Alex Hoppen
ea21175dd7 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.
2024-09-09 18:00:05 -07:00
Alex Hoppen
027f3ee1f4 Push creation of BuiltInBuildSystem into the workspace
This way we create the `BuiltInBuildSystem` at the same time that we create the `BuildSystemManager`, which gets us one step closer to creating the `BuiltInBuildSystem` from the `BuiltInBuildSystemAdapter`.
2024-09-09 17:59:46 -07:00
Alex Hoppen
b490a6fef1 Use buildTarget/inverseSources from BSP to get targets of a source file 2024-09-09 16:31:30 -07:00
Alex Hoppen
e38d37e01c Use workspace/didChangeWatchedFiles from BSP to communicate file changes to the build system 2024-09-09 16:31:00 -07:00
Alex Hoppen
b4d04ce983 Introduce a BuiltInBuildSystemAdapter that can be used to transition BuildSystem to a type that implements BSP 2024-09-09 16:31:00 -07:00