Alex Hoppen
d8b41d4eff
Merge pull request #1685 from ahoppen/only-scan-test-targets
...
Only scan test targets for tests
2024-09-19 20:41:40 -07:00
Alex Hoppen
6248d22897
Merge pull request #1683 from ahoppen/traverse-modules
...
Adopt faster `traverseModules` implementation in SwiftPM
2024-09-19 18:03:17 -07:00
Alex Hoppen
120bd8688b
Only scan test targets for tests
...
Don’t run the syntactic test scanner on files that we know are only part of non-test targets.
rdar://126493903
2024-09-19 13:42:40 -07:00
Alex Hoppen
82e0036b96
Don’t send messages to the BSP server before the build/initialize request returns
...
We currently allow sending requests to the BSP server before `build/initialize` returns. This is not valid in general and we should wait for the initialize result before sending any other messages.
rdar://136111469
2024-09-19 13:41:45 -07:00
Alex Hoppen
40cc4c60c6
Adjustments because traverseModules no longer returns depth
...
We no longer need `depth`. Adopt a faster version of `traverseModules` that doesn’t return the depth.
rdar://136107035
2024-09-19 13:40:45 -07:00
Alex Hoppen
478227308b
Merge pull request #1682 from ahoppen/swiftpm-symlink
...
Fix an issue that caused us to not get compiler arguments when opening a SwiftPM package at a symlink
2024-09-19 13:38:11 -07:00
Alex Hoppen
b8b53633cf
Merge pull request #1676 from ahoppen/no-reload-if-settings-didnt-change
...
Only reopen files for which the build settings actually changed
2024-09-18 17:42:25 -07:00
Alex Hoppen
14765bbca8
Fix an issue that caused us to not get compiler arguments when opening a SwiftPM package at a symlink
...
When you had a package at `/pkg_real` and a symlink `/pkg` pointing to `/pkg_real`, then opened a workspace at `/pkg`, we wouldn’t get any build settings for any of the files. This was masked in tests because they still called `SwiftPMBuildSystem.targets(for:)`, which handled symlink resolution but wasn’t called in production.
Handle symlink resolution `BuildSystemManager`, remove `SwiftPMBuildSystem.targets(for:)` and its related members/methods, and migrate the tests to go through `BuildSystemManager`, which is what production code does. A nice side effect of this is that the tests will log the requests sent to the build system.
2024-09-18 17:41:36 -07:00
Alex Hoppen
0f78562eb4
Only reopen files for which the build settings actually changed
2024-09-18 07:57:55 -07:00
Alex Hoppen
2446a32604
Fix a memory leak
...
We had a retain cycle from `BuildSystemManager` to `LocalConnection`. Fix it by making `LocalConnection` have a weak reference to `BuildSystemManager`.
2024-09-18 07:55:15 -07:00
Alex Hoppen
7ab7c01cdc
Require a Swift 6 compiler to build SourceKit-LSP
...
Xcode 16 with Swift 6 has been released, we can drop support for building and testing SourceKit-LSP using a Swift 5.10 toolchain. This allows us to remove a number of workarounds.
2024-09-17 16:53:13 -07:00
Alex Hoppen
d8b2cb2a82
Mark all transitive dependents of a modified target as being unprepared
...
We weren’t considering transitive dependencies in `BuildSystemManager.targets(dependingOn:)` before.
rdar://136039234
2024-09-17 14:37:24 -07:00
Alex Hoppen
e15bdd7e90
Review SwiftPMBuildSystem.swift
2024-09-16 10:13:20 -07:00
Alex Hoppen
2c2d9f9318
Review PrefixMessageWithTaskEmoji.swift
2024-09-16 10:13:12 -07:00
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