mirror of
https://github.com/apple/swift-crypto
synced 2026-11-23 04:34:21 +00:00
## Summary Fixes #435. On Apple platforms every source file in the `Crypto` target compiles to just `@_exported import CryptoKit` (because `CRYPTO_IN_SWIFTPM` is defined but `CRYPTO_IN_SWIFTPM_FORCE_BUILD_API` is not), producing **zero exported symbols**. Xcode 26 changed how SPM packages are built for test-target dependencies: each package product is built as a separate dynamic framework. A module with no symbols generates a `.framework` directory but no Mach-O binary, causing a linker error: ``` clang: error: no such file or directory: '.../PackageFrameworks/Crypto_17A3B1FFC41E47_PackageProduct.framework/Crypto_17A3B1FFC41E47_PackageProduct' ``` ## Fix Added a minimal `_CryptoModuleAnchor` public enum (outside the conditional compilation guard) so the module always produces at least one exported symbol, regardless of how it is linked. The type is prefixed with `_` to signal it is not intended for public use. ## Test plan - [ ] Build a project with a test target that has `swift-crypto` (or a transitive dependency like `swift-certificates`) as a `packageProductDependency` on Xcode 26 targeting iOS Simulator — should now succeed - [ ] Verify existing tests still pass (`swift test`) --------- Co-authored-by: Niccolò Calamai <niccolo.calamai@esselunga.it> Co-authored-by: Cory Benfield <lukasa@apple.com>