I have a similar setup in which I don't understand why the conflict would take a place. I will first show the setup, and then share why I think there should not be such a conflict
Linkage scheme is basic "nested dependency" case, where the dependency is static xcframework
MyApp -> FirebaseAnalytics.xcframework (Static)
MyApp -> MyFramework (Dynamic) -> FirebaseAnalytics.xcframework (static)
I use Workspace to build MyFramework as a dependency
Workspace (named HRS)
* MyApp project
** MyApp target (links MyFramework.framework from Workspace -> MyFramework project)
* MyFramework project
** MyFramework target
When in Workspace I build MyApp, it first gives me warnings, such as
duplicate output file '/Users/oleksiinezhyborets/Library/Developer/Xcode/DerivedData/HRS-etdtlgdbraymsbdmilzwmgmwkjgs/Build/Products/Debug-iphonesimulator/FirebaseAnalytics.framework' on task: ProcessXCFramework /Users/oleksiinezhyborets/Projects/tv_mobile_ios 2/MyFramework/FirebaseFrameworks/Analytics/FirebaseAnalytics.xcframework /Users/oleksiinezhyborets/Library/Developer/Xcode/DerivedData/HRS-etdtlgdbraymsbdmilzwmgmwkjgs/Build/Products/Debug-iphonesimulator/FirebaseAnalytics.framework ios simulator
And then error:
Multiple commands produce '/Users/oleksiinezhyborets/Library/Developer/Xcode/DerivedData/HRS-etdtlgdbraymsbdmilzwmgmwkjgs/Build/Products/Debug-iphonesimulator/FirebaseAnalytics.framework'
Command: ProcessXCFramework /Users/oleksiinezhyborets/Projects/tv_mobile_ios 2/MyApp/FirebaseFrameworks/FirebaseAnalytics/FirebaseAnalytics.xcframework /Users/oleksiinezhyborets/Library/Developer/Xcode/DerivedData/HRS-etdtlgdbraymsbdmilzwmgmwkjgs/Build/Products/Debug-iphonesimulator/FirebaseAnalytics.framework ios simulator
Command: ProcessXCFramework /Users/oleksiinezhyborets/Projects/tv_mobile_ios 2/MyFramework/FirebaseFrameworks/Analytics/FirebaseAnalytics.xcframework /Users/oleksiinezhyborets/Library/Developer/Xcode/DerivedData/HRS-etdtlgdbraymsbdmilzwmgmwkjgs/Build/Products/Debug-iphonesimulator/FirebaseAnalytics.framework ios simulator
So, ok, I understand that Xcode and New Build System doesn't support multiple same output files. But I think it should work in such a setup because of the combination of factors:
- Firebase is linked statically to MyFramework, thus, at the end of MyFramework build there wouldn't be FirebaseAnalytics.xcframework in output destination. They are probably needed temporarily while build happens.
- Because MyApp depend on MyFramework, dependencies in the setup build serially one after another.
My thought is, there is some kind of checker in Xcode that checks output files at start of a build, and if there are duplicates, it gives error right away. In this case it checks outputs of ProcessXCFramework. But in this case it's restrictive without a reason. In this case, we will have 2 steps: first MyFramework would process its Firebase xcframeworks, build the framework, and remove all the temporary xcframeworks. And then the app target would also process same xcframeworks at the same place. But as MyFramework is already build into a single binary and all temporary files are removed, there wouldn't be a conflict.
It prevents from automatically rebuilding the dependent framework, and also from debugging the framework with breakpoints. Access to both these features is pretty needed for a better development. I do understand that covering different cases in build system make it even more complex, but this case seems to be pretty basic, so if I'm right that it may be fixes, it may be good if it's fixed