I'm building an App's test target with xcodebuild. The test target includes tests from a Swift Package, which has an XCFramework .binaryTarget—SwiftProtobuf.xcframework. We have used a symlink to link from a directory inside the Swift Package's directory, to the XCFramework, since you can't include a .binaryTarget from outside the Package's own directory structure (which isn't a bug, but nonetheless, is really dang annoying).
The build itself will encounter the error:
/REDACTED/TensorManifold/Sources/TensorManifold/base.pb.swift:13:8:
error: no such module 'SwiftProtobuf'
import SwiftProtobuf
This error happens BEFORE we get to this build step:
ProcessXCFramework /REDACTED/TensorManifold/lib/SwiftProtobuf.xcframework
(in target 'TensorManifold' from project 'TensorManifold')
The build command that was run:
set -o pipefail && env NSUnbufferedIO=YES xcodebuild \
-workspace REDACTED.xcworkspace \
-scheme AllUnitTests -configuration Debug_Testing \
-derivedDataPath /private/tmp/build/REDACTED/ios/fastlane/output/derivedData \
-destination 'platform=iOS Simulator,name=iPhone 7,OS=14.3' \
clean build-for-testing
Here is what our Package.swift looks like:
import PackageDescription
let package = Package(
name: "TensorManifold",
platforms: [
.iOS(.v13),
],
products: [
.library(
name: "TensorManifold",
targets: ["TensorManifold", "SwiftProtobuf"]
),
],
dependencies: [
],
targets: [
.target(
name: "TensorManifold",
dependencies: ["SwiftProtobuf"]
),
.binaryTarget(
name: "SwiftProtobuf",
path: "lib/SwiftProtobuf.xcframework" // this is a symlink
// it builds just fine in Xcode
),
]
)