Repository navigation
Link OpenCombine into the tests only, not into SkipModel - #31
Merged
Merged
Conversation
The SkipModel target's Swift is entirely #if SKIP, so its native build never imports OpenCombine; only SkipModelTests does when Combine is unavailable. Keeping OpenCombine on the SkipModel product embeds it statically into libSkipModel.so, and Swift 6.4's default swiftbuild engine rejects that graph whenever a Fuse app also links OpenCombine into its own dynamic products: error: Swift package product 'OpenCombine-product' is linked as a static library by 'USLive-product' and 'SkipModel-product'. This will result in duplication of library code. Moving the dependency to the test target keeps the Linux tests compiling and takes SkipModel out of that diamond.
Member
|
Good catch, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Swift 6.4 makes
swiftbuildthe default SwiftPM engine, and it turns the old static-duplication warning into an error. A Skip Fuse app that links OpenCombine into its own dynamic products (the usual#if canImport(Combine) … #else import OpenCombinepattern) now failsswift build --swift-sdk …-android… --build-testson a Linux host with:Every reported pair involves
SkipModel-product; the app's own products never conflict with each other in that check. The only workaround today is--build-system native, which SwiftPM 6.4 already marks deprecated.Cause
Package.swiftadds OpenCombine to the SkipModel target under#if !canImport(Combine), but the target's native Swift never uses it: every file inSources/SkipModelis wrapped in#if SKIPexceptSkipModel.swiftandStateTracking.swift, neither of which references Combine.libSkipModel.sobuilt foraarch64-unknown-linux-android28confirms it — 0 OpenCombine symbols defined or referenced, and no OpenCombine library in itsNEEDEDlist. OnlySkipModelTestsimports OpenCombine, for theobjectWillChange/@Published/sinktests.Because the manifest condition is evaluated on the host, the dependency is present on Linux hosts and absent on macOS hosts, so the error only shows up in Linux CI — a macOS
skip android teston the same package plans cleanly underswiftbuild.Change
Move the two OpenCombine products from
targets[0](SkipModel) totargets[1](SkipModelTests). Test targets are not dynamic library products, so they cannot form the diamond, and the Linuxswift testbuild keeps compiling. Comment updated to say why.Verified
skip android teston a bridged multi-module package plans and builds under the defaultswiftbuildengine with this dependency shape (the SkipModel edge is what the Linux CI error names, and it is the only edge that differs between the two hosts).swift teston ubuntu should be unaffected.Related: skiptools/skip#714 (the same 6.4 hard error for SkipLib/SkipUnit, fixed via
SKIP_DYNAMIC_LIBRARIES).Where the dependency came from
It was added in #14 ("Linux support"), whose diff touches only
.github/workflows/ci.yml(addsubuntu-24.04),Package.swift(this block) andTests/SkipModelTests/SkipModelTests.swift(the#if canImport(OpenCombine)imports) — nothing underSources/. The environment that needed OpenCombine wasswift teston a Linux host; attaching it to the library target was just the shortest way to make the tests see the module. Attaching it to the test target directly serves the same need without the library-product diamond.