Skip to content

Link OpenCombine into the tests only, not into SkipModel - #31

Merged
marcprux merged 1 commit into
skiptools:mainfrom
piercifani:skipcombine-dynamic-wrapper
Sep 18, 2026
Merged

marcprux merged 1 commit into
skiptools:mainfrom
piercifani:skipcombine-dynamic-wrapper

Conversation

@piercifani

@piercifani piercifani commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Swift 6.4 makes swiftbuild the 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 OpenCombine pattern) now fails swift build --swift-sdk …-android… --build-tests on a Linux host with:

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.
error: Swift package product 'OpenCombineFoundation-product' is linked as a static library by 'PolymarketSharedTests-product' and 'SkipModel-product'. This will result in duplication of library code.

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.swift adds OpenCombine to the SkipModel target under #if !canImport(Combine), but the target's native Swift never uses it: every file in Sources/SkipModel is wrapped in #if SKIP except SkipModel.swift and StateTracking.swift, neither of which references Combine. libSkipModel.so built for aarch64-unknown-linux-android28 confirms it — 0 OpenCombine symbols defined or referenced, and no OpenCombine library in its NEEDED list. Only SkipModelTests imports OpenCombine, for the objectWillChange / @Published / sink tests.

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 test on the same package plans cleanly under swiftbuild.

Change

Move the two OpenCombine products from targets[0] (SkipModel) to targets[1] (SkipModelTests). Test targets are not dynamic library products, so they cannot form the diamond, and the Linux swift test build keeps compiling. Comment updated to say why.

Verified

  • macOS host, Swift 6.4 (Xcode 27), skip 1.9.10: skip android test on a bridged multi-module package plans and builds under the default swiftbuild engine 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).
  • The SkipModel target's Android build output has no OpenCombine references before or after the change.
  • I could not run this repository's Linux CI myself; the test target keeps the same OpenCombine products it imports today, so swift test on 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 (adds ubuntu-24.04), Package.swift (this block) and Tests/SkipModelTests/SkipModelTests.swift (the #if canImport(OpenCombine) imports) — nothing under Sources/. The environment that needed OpenCombine was swift test on 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.

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.
@cla-bot cla-bot Bot added the cla-signed label Sep 18, 2026
@marcprux

Copy link
Copy Markdown
Member

Good catch, thanks!

@marcprux
marcprux merged commit 933fe70 into skiptools:main Sep 18, 2026
3 checks passed
@piercifani
piercifani deleted the skipcombine-dynamic-wrapper branch September 18, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants