Hi!
I have a Catalyst app that embeds command line utility. So the project has two targets:
- Catalyst target, this target depends on #2 and embeds it into its bundle.
- macOS target, the command line tool.
Both targets have package dependency to the same package.
I used this to embed the CMD tool.
Everything builds, runs and works fine until I try to archive the project. Archiving stops early with such error:
error: Multiple commands produce '/Users/kse2/Library/Developer/Xcode/DerivedData/PkgTest-clngkndczxoprpdlwefqqiqlryjt/Build/Intermediates.noindex/ArchiveIntermediates/PkgTest/IntermediateBuildFilesPath/UninstalledProducts/macosx/MacrosForSwift.o'
note: Target 'MacrosForSwift' (project 'MacrosForSwift') has a command with output '/Users/kse2/Library/Developer/Xcode/DerivedData/PkgTest-clngkndczxoprpdlwefqqiqlryjt/Build/Intermediates.noindex/ArchiveIntermediates/PkgTest/IntermediateBuildFilesPath/UninstalledProducts/macosx/MacrosForSwift.o'
note: Target 'MacrosForSwift' (project 'MacrosForSwift') has a command with output '/Users/kse2/Library/Developer/Xcode/DerivedData/PkgTest-clngkndczxoprpdlwefqqiqlryjt/Build/Intermediates.noindex/ArchiveIntermediates/PkgTest/IntermediateBuildFilesPath/UninstalledProducts/macosx/MacrosForSwift.o'
What I have tried to fix archiving:
- Changing PkgTestCMD target to be on Catalyst/iOS instead of macOS. This works but I'm not sure how to properly run CMD tool with iOS SDK (if this correct at all): I need the main thread to be 'unblocked' and be active while background tasks exist.
- Adding an aux framework that act as container for the package. Doesn't work.
- Splitting targets into different projects, making workspace and cross-project reference. Doesn't work.
My understanding is that archiving attempts to produce .o files for both Catalyst and macOS simultaneously, due to PkgTest being Catalyst and PkgTestCMD being macOS targets.
How to archive such a project? Is there a way to separate archiving of CMD and main app? Maybe separate .o files into different directories.
Simple building and running the project works, why archiving doesn't want to?
I have a test project for the issue: PkgTest. main branch is the source project, DepFramework contains attempt #2, Workspace—#3.
Thank you!