Swift Build does not stage a binary framework for executable-target tests on macOS
### Description
A macOS package has an executable target that depends on the Sparkle binary-framework product and an XCTest target that depends on that executable target:
.executableTarget(
name: "Record",
dependencies: [.product(name: "Sparkle", package: "Sparkle")]
)
.testTarget(name: "RecordTests", dependencies: ["Record"])
Swift Build compiles and links the package and test bundle, but running RecordTests fails because Sparkle.framework was not staged in .build/out/Products/Debug/PackageFrameworks or beside the test bundle. Other test targets that do not link the executable pass.
### Reproduction
Public package and CI reproduction: https://github.com/aindaco1/record/pull/46
Failing Xcode 27 job: https://github.com/aindaco1/record/actions/runs/31211843519/job/92976249348
On macOS with Xcode 26.5 and Swift 6.3.3:
swift build --build-system swiftbuild
swift test --build-system swiftbuild --filter RecordingElapsedClockTests
The build succeeds, then swiftpm-xctest-helper fails to load RecordTests:
Library not loaded: @rpath/Sparkle.framework/Versions/B/Sparkle
Reason: tried: .../.build/out/Products/Debug/PackageFrameworks/Sparkle.framework/... (no such file)
The same failure occurs under Xcode 27 beta 4 (27A5228h), Swift 6.4 (swiftlang-6.4.0.27.1), where the default swift test invocation uses the Swift Build output layout and swiftpm-testing-helper exits with signal 5.
### Expected behavior
Swift Build should stage the binary framework in a location covered by the generated test-bundle rpaths, matching the native build-system behavior.
### Workaround
The following keeps Swift Build compile coverage and runs the complete tests with the native engine:
swift build --build-system swiftbuild
swift test --build-system native
Both the full test suite and release build pass with the native engine. Adding a redundant direct Sparkle dependency to the test target or manually copying a framework into .build would hide the dependency-graph/staging problem, so the package does not do either.
关闭于 17 天前 1 条评论