Post

Replies

Boosts

Views

Activity

Reply to Multiple commands produce framework
For anyone struggling with this, I haven't been able to figure out why Xcode does this, but I've figured out a way to stop this from happening. When Carthage bootstraps it must set up every dependency in Carthage/Checkouts so that it can be built individually. Which means that for each dependency in Carthage/Checkouts, its own Carthage/Build folder must be populated and each of its dependencies in Carthage/Checkouts must be set up the same way and so on down the dependency graph. So if we have an app which depends on frameworks A and B, but A also depends on B, after running carthage bootstrap, the directory structure should look something like this: App/ Carthage/ Build/ A.xcframework B.xcframework Checkouts/ A/ Carthage/ Build/ B.xcframework Checkouts/ B/ B/ Now, the problem is Xcode will try to copy both App/Carthage/Build/B.xcframework and App/Carthage/Checkouts/A/Carthage/Build/B.xcframework to the built products directory. So I tried just deleting any nested Carthage/Build directories in the dependencies in App/Carthage/Checkouts after running carthage bootstrap. And it worked. Those directories are only needed when building the dependencies anyway. After that is done, they are no longer needed. For clarity, this is how the directory structure looks after deleting the nested Carthage/Build directories: App/ Carthage/ Build/ A.xcframework B.xcframework Checkouts/ A/ Carthage/ Checkouts/ B/ B/ One thing to note is that the nested Carthage/Build directories are actually symlinks to App/Carthage/Build. This is how Carthage builds each dependency in the dependency graph only once.
Sep ’22