Enable a more portable binary on macOS - Approach 2 #480
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
To make the
periphery
binary more portable on macOS, we want to have the lib_internalSwiftSyntaxParser library statically linked into the binary instead of having to link to a dylib version somewhere on the system.Approach 2
This is a second take on the approach used in #476, the main problem I'm trying to work around in these solutions is that I can't use binary targets in this Package.swift since it breaks
swift package describe
(SR-15243 and SR-15065).In this approach, I work around that by using a fork of the apple/swift-syntax repo where I have made some minor modifications to the Package.swift file so that the StaticInternalSwiftSyntaxParser dependency is properly declared on the SwiftSyntax/SwiftSyntaxParser targets directly.
While forking the official dependency is somewhat of an inconvenience, it feels like the 'cleanest' approach since it avoids having to do other workarounds like the one used in the first approach, or like those that have to exist in SwiftLint/Sourcery.
Since the fork is only used to reconfigure the Package.swift, it doesn't feel like that big of a problem (we're just using it to re-tag the releases after patching), but ideally I'd like to transfer the fork/tags into the peripheryapp org as well.
Here are the diffs between the new tags in swift-syntax repo:
swiftlang/swift-syntax@0.50600.1...liamnichols:0.50600.1-static
swiftlang/swift-syntax@0.50500.0...liamnichols:0.50500.0-static