Open tishin opened 5 months ago
It's possible now to run tests by changing MyLibrary
's depependency to SwiftGodotStatic
:
.target(
name: "MyLibrary",
dependencies: [
- .product(name: "SwiftGodot", package: "SwiftGodot"),
+ .product(name: "SwiftGodotStatic", package: "SwiftGodot"),
]),
It's a bit counterintuitive, and if you want to keep SwiftGodot
dynamic, you'd have to switch between the two to run tests. But since it's not possible to link internal package target dynamically, the only option to make dynamic SwiftGodot
product testable is to split the package into multiple package description files and make SwiftGodotTestability
dependant on the dynamic SwiftGodot
product instead of the internal target. And I'm not sure if it's reasonable.
Given a simple package description with an extension target depending on
SwiftGodot
and a test target depending onSwiftGodotTestability
:Running tests throws an error:
Swift package target 'SwiftGodot' is linked as a static library by 'MyLibraryTests' and 'SwiftGodot', but cannot be built dynamically because there is a package product with the same name.
SwiftGodot
is linked dynamically to the extension targetMyLibrary
, but it's linked statically toSwiftGodotTestability
, which is linked statically toMyLibraryTests
. MarkingSwiftGodotTestability
as a dynamic product does not solve the issue, becauseSwiftGodot
target would still be linked statically toSwiftGodotTestability
, still causing a mismatch with its dynamic product counterpart.