Post not yet marked as solved
Post marked as unsolved with 2 replies, 1,296 views
Hello. My app is composed of multiple first party frameworks some of which depend on each other. Up until recently, they were all in a single workspace alongside the app, but I had to move them to separate repos in order to reuse some of them in a different app.
For simplicity, let's say that I have a Common framework and frameworks A, B and C that all depend on Common. The app itself also depends on Common.
I'm using Carthage for dependency management. I'm using it to build XCFrameworks. Everything is set up and the app builds and runs normally. However, since I want to be able to debug my frameworks from within the workspace of the app, I want to add the projects from the Carthage/Checkouts folder to the workspace. I can add the Common project this way just fine and everything works normally. However, as soon as I add a project that depends on Common (let's say B), Xcode starts spewing Multiple commands produce Common.xcframework when I attempt to build the app. Looking at the build logs I can see that it is trying to copy the Common.xcframework both from the Carthage/Build directory (which is the correct place to copy them from) AND the Carthage/Checkouts/B/Carthage/Build (which is the Carthage/Build directory of the subproject B). I cannot figure out why Xcode is attempting to copy from there. No target depends on the B subproject. The only thing that has a reference to the project is the .xcworkspace file. The build logs do not show that Xcode is trying to build the target of the B project.
I've also reproduced this in an empty app using the same frameworks. Can anyone explain why Xcode does this? Why is it attempting to copy frameworks from a place unrelated to the target it is currently building? And is there a way to get around this? Any pointers would be very welcome. Thank you.
Using Xcode 13.1