[build-script] Add support for building static XCTest - #91049
Conversation
|
@swift-ci please test |
|
swiftlang/swift-testing#1815 @swift-ci please build toolchain Ubuntu 24.04 |
|
Would be great if we could add this for Android too, pinging @swiftlang/android-workgroup if anyone wants to work on it. |
|
I'm not sure if static linking XCTest is actually supported; CC: @grynspan @stmontgomery @briancroom |
|
It is not supported, no. On non-Apple platforms, it's technically feasible but comes with a bunch of questions we need to answer first; on Apple platforms, it's not really possible because XCTest and Swift Testing are distributed with Xcode as frameworks. |
is there context on this I can read up on? This is intended only for non-apple platforms (specifically I'm most interested in Linux) |
|
swiftlang/swift-testing#1815 @swift-ci please build toolchain Ubuntu 24.04 |
No as I don't think we've even defined all the questions. But in general, if you statically link to Swift Testing or XCTest, you've now got a copy in your executable that could end up shipping to customers. That's not something we want to enable.
Changes to Swift Testing or XCTest need to take Apple platforms into account too. While you're not interested in them, we are. |
|
swiftlang/swift-testing#1815 @swift-ci please build toolchain Ubuntu 24.04 |
I think this concern is mostly around how we surface this from the build system? For the swiftpm use case users doing
I didn't mean to imply that I don't care about Apple platforms with this change, just that the intent of this change is to have no effect on toolchains targeting Apple platforms. Please left a comment on the code if you see somewhere where that's not the case! If you think it's worth it we can add some hard fails in the various cmake files if you even attempt to build the static variants targeting macOS. |
Depends on:
Work towards swiftlang/swift-package-manager#5590