Commit Graph

75 Commits

Author SHA1 Message Date
Alex Hoppen
db539b06ec Review TestBuildSystem.swift 2024-09-16 10:13:05 -07:00
Alex Hoppen
0bdbb507c9 Review CompilationDatabaseBuildSystem 2024-09-16 10:12:58 -07:00
Alex Hoppen
3753837858 Review CompilationDatabase.swift 2024-09-16 10:12:50 -07:00
Alex Hoppen
bc9ee378d7 Review QueueBasedMessageHandler 2024-09-16 10:12:41 -07:00
Alex Hoppen
316790ff7a Review BuiltInBuildSystem 2024-09-16 10:12:34 -07:00
Alex Hoppen
5996e56010 Review BuiltInBuildSystemAdapter 2024-09-16 10:12:26 -07:00
Alex Hoppen
d155665b73 Review BuildSystemManager 2024-09-16 10:12:18 -07:00
Alex Hoppen
0f56e5f32e Simplify FallbackBuildSystem to a free function returning fallback arguments 2024-09-16 10:12:09 -07:00
Alex Hoppen
a9578bbb45 Review BuildSystemMessageDependencyTracker 2024-09-16 10:12:08 -07:00
Alex Hoppen
9ee7c59c7d Minor cleanups 2024-09-16 10:10:26 -07:00
Alex Hoppen
3a78b650c1 Share logic to infer language from file extension between BuildSystemManager and FileBuildSettings.patching 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
80afa152fb Replace FIXME with TODO 2024-09-16 10:10:26 -07:00
Alex Hoppen
cb2924a5fb Remove sourceFilesDidChange
This was equivalent to `buildTargetsDidChange`
2024-09-16 10:08:14 -07:00
Alex Hoppen
79e1d2abad If we have a cached request for a superset of the targets, serve the result from that 2024-09-16 10:08:14 -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
8a1096375d Remove double logging of BSP replies 2024-09-16 10:08:14 -07:00
Alex Hoppen
29cfda032c Refactor sourceFiles to return a dictionary from DocumentURI to SourceFileInfo instead of a SourceFileInfo array 2024-09-16 10:08:13 -07:00
Alex Hoppen
70288465dc Log target name instead of the target's URI 2024-09-16 10:07:31 -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
d00722e33f Use BSP to log messages from preparation in the build system 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
a96c0913ad Implement addSourceFilesDidChangeCallback in BuildSystemManager 2024-09-13 11:12:40 -07:00
Alex Hoppen
fac21f5976 Implement waitForUpToDateBuildGraph using BSP 2024-09-13 11:12:40 -07:00
Alex Hoppen
12923b6d73 Implement toolchain(for:) using BSP 2024-09-13 11:12:40 -07:00
Alex Hoppen
d8161b371f Cache build targets by ID and associated depths
We often need targets by ID, so cache it at that level and also simplify the cache of the target depths by computing it when getting build targets.
2024-09-13 11:12:40 -07:00
Alex Hoppen
cc11fe1b02 Implement topologicalSort inside BuildSystemManager using dependency information 2024-09-12 17:26:41 -07:00
Alex Hoppen
bb96ff4c68 Migrate targets(dependingOn:) to BSP 2024-09-12 16:59:03 -07:00
Alex Hoppen
897cd5e775 Implicitly trigger build graph generation when creating a SwiftPMBuildSystem 2024-09-12 16:24:48 -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
022a6de6c3 Handle filesDependenciesUpdated in BuildSystemManager instead of the build system
The implementation of which file’s dependencies have been updated is common across all build systems and thus build systems shouldn’t need to implement this logic. This also allows us to remove `BuildSystemDelegate`.
2024-09-12 07:34:12 -07:00
Alex Hoppen
9d94fe36a9 Migrate defaultLanguage(for:) to BSP 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
7e3f453a7c Remove registerForChangeNotifications
This was only really used for the legacy BSP integration, which we are phasing out in favor of the new `SourceKitOptions` request.
2024-09-11 08:40:12 -07:00
Alex Hoppen
236f566977 Instead of having FileHandlingCapability for a source file, check if it belongs to any targets 2024-09-11 08:27:12 -07:00
Alex Hoppen
37f7540ebe Merge pull request #1656 from ahoppen/workspace-delegate
Make `Workspace` the delegate of a `BuildSystemManager`
2024-09-11 08:23:25 -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
57055d4135 Make Workspace the delegate of a BuildSystemManager
`Workspace` is responsible for creating the `BuildSystemManager` and responds to most of the delegate calls. It should thus also be the delegate of `BuildSystemManager`.
2024-09-10 15:22:18 -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
9f4088038c Create BuiltInBuildSystem in BuildSystemManager
This moves the creation another step closer to creating the `BuiltInBuildSystem` inside `BuiltInBuildSystemAdapter`.
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