I have trouble getting Carthage support for a project using the SwiftPM.
From my limited understanding, Carthage needs an xcodeproj that it finds on a git repo, and it "just builds it". More than that, Carthage has a system to declare Carthage dependencies (the "Cartfile").
Say now you have a project based on the SwiftPM (grpc-swift is such a project). For the project to support Carthage, you need to generate an xcodeproj, which we do here. But for the project to build with Carthage, I needed to add a new script phase to the xcodeproj (done here, running
swift package resolve.
And that kind of solves the problem: if you run
make project-carthage, it creates an xcodeproj that you can push on the repo, and Carthage can access it. So a workaround sounds like "everytime you release grpc-swift, run
make project-carthage and version the resulting project, so that the commit of this release works".
Now, the generated xcodeproj has some dependencies that look like:
grpc-swift/.build/checkouts/swift-protobuf.git-442897717507903005 (in the
.build folder). And it seems like the "id" of that link is deterministic, but changes depending on the version of Xcode (at least we observe that between Xcode 9 and Xcode 10 here.
In other words, a project generated from Xcode 9 with
swift package generate-xcodeproj and then
swift package resolve can be compiled by another Xcode 9, but cannot be compiled by Xcode 10.
The question then is: where does that number come from (442897717507903005), and would it be possible to disable it, such that the project is always consistent? I don't know what that would imply, I guess there is a reason for this number.
I have this issue right now with grpc-swift, but I believe there are probably other SwiftPM projects out there that would also like to support Carthage, so maybe that's a known issue on your side?