Trying to migrate to using .xcframeworks as binary targets within SPM, but running into the following error:
xcodebuild: error: Could not resolve package dependencies:
target 'SwiftProtobuf' in package 'REDACTED' is outside the package root
This is how I linked the binary targets:
.binaryTarget(
name: "SwiftProtobuf",
path: "../../Carthage/Build/SwiftProtobuf.xcframework"
),
Previously we were doing this, which worked fine:
dependencies: [
.package(path: "../../Carthage/Checkouts/swift-protobuf")
],
targets: [
.target(
name: "REDACTED",
dependencies: ["SwiftProtobuf"]
)
]
Why does SPM let me add a dependency package from outside the package's directory, but not a binary target? Is this a bug or intended...?
Seems like it's what Apple intended, since there's a verbose error about it. However, what do they expect us to do—put a unique copy of each binary target inside each package's directory structure? Resort to symlinking? Neither option seems particularly practical.
Should I just go ahead and file a radar?
Note: was able to trick it to build by just making a symlink inside a "lib" folder in the package root that links to "../../Carthage/Build/SwiftProtobuf.xcframework", then doing:
.binaryTarget(
name: "SwiftProtobuf",
path: "lib/SwiftProtobuf.xcframework"
),
And yet the linked-in framework is still outside the package root. So why does it let me do this, on the one hand, but I can't just specify the path, on the other hand?