-
Notifications
You must be signed in to change notification settings - Fork 440
RFC: Remove lib_InternalSwiftSyntaxParser as a link-time dependency #290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
Build failed |
Build failed |
Hmm, I'm unable tor reproduce the source kit stress tester failure locally, I assume there's some kind of rpath problem though |
@swift-ci please test |
Build failed |
Build failed |
Hi @owenv, To clarify what you are trying to achieve here: You want to remove the link-dependency from SwiftSyntax to If this is what you are trying to achieve, I don’t think it’ll be of much benefit (unless I’m missing something). You will be able to verify that SwiftPM builds against the most recent SwiftSyntax library, but now we need to make sure that SwiftSyntax works with the current What I’d propose is that you pick up the |
As I understand it, the main issue is that folks developing SwiftPM want to be able to do so with an incompatible parser lib and without editing the manifest, but also want to know about API breakage on the main branch before running tests on CI. The original approach I had (which is better IMO) to adding the SwiftSyntax dependency conditionally compiled it out of the package when a compatible parser lib isn't available, but that's pretty much stalled so I was experimenting with this instead. That said, I think the approach here just creates more problems than it solves. |
To clarify, the incompatibility of SwiftSyntax with parser lib is primarily manifested at runtime (with a runtime check when you try to use it to parse some source), it's not manifested at build time (the C API has been stable). |
Use a wrapper type instead of retro-conforming `FileHandle` to `TextOutputStream`.
I'd appreciate any thoughts & feedback anyone has on this!
This PR removes the link-time dependency on a compatible lib_InternalSwiftSyntaxParser. Instead, it uses dlopen & dlsym at runtime, following the approach SwiftDriver uses to load the dependency scanning library. The motivation here is to be able to add a SwiftSyntax dependency to SwiftPM to implement SE-301's package manifest editing commands. Per the discussion here, the SwiftPM team wants to be able to build the package syntax support library (which uses SwiftSyntax) when there's no compatible parser library available, so that breaking changes can be detected before testing on CI. This change should make that possible, and a SwiftPM built in a local dev environment without a compatible library will report a library mismatch error.
The main downside of this approach is that it requires keeping the parser library's header in-sync with the one in the main swift repository, and I had to copy over a bit of TSCUtility code for cross-platform dlopen.