Xcode Cloud not working with local packages

Hi,

I'm trying out Xcode Cloud but can't get it to build in my scenario. The use case is the following:

My project has multiple swift packages that depend on each other. "App" has a local package dependency called "SPMKit". "SPMKit" has a local package dependency called "SPMKit2".

The issue I run into is if "SPMKit2" has any dependencies, it doesn't resolve in Xcode Cloud.

Are local dependencies like this not supported in Xcode Cloud? All the packages are in the same directory as my app. I'd like to not have to put each package in it's own git..

Post not yet marked as solved Up vote post of Joebayld Down vote post of Joebayld
1.9k views
  • We are having the same issue. It's an impediment to the use of XCode cloud so we are switching back to Gitlab. Does anybody has any news on this? A workaround maybe?

Add a Comment

Replies

Local packages are supported; however, we're looking into an issue with them in Xcode Cloud at the moment. Could use Feedback Assistant to open a bug report, and include a build link to a failed build on App Store Connect, as well as your example project? Having this info will assist us in looking into this. Please post the FB number here.

I'm having the same issue - FB9808718 (Xcode cloud failing with local Swift Packages)

FWIW I was able to get past this by manually disabling the flags that Xcode Cloud adds.

Add this file to the root of your repo at the following path: ci_scripts/ci_post_clone.sh

defaults delete com.apple.dt.Xcode IDEPackageOnlyUseVersionsFromResolvedFile
defaults delete com.apple.dt.Xcode IDEDisableAutomaticPackageResolution
  • @featherless thanks for your suggestion, it works !

    I have a bit more to add, if you add you local SwiftPM dependency using Xcode 15, this workaround will not work. So if you have a new project, make sure you add you local package through Xcode 14, and apply @featherless fix to make it works on Xcode 15 with Xcode Cloud. (you can then use Xcode 15)

Add a Comment

For anyone running into this, in-case you have your app and local package together in the same Xcode workspace, make sure you select to run the Xcode Cloud workflow in the workspace (not app project). This was the issue for me that caused "Missing package product 'MyPackageName'" on Xcode Cloud builds. See this screenshot for the setting on the Xcode Cloud workflow:

Have faced this earlier and fixed it by adding back Package.resolved file into the repo.

It's not because SPMKit2 doesn't have dependencies but you didn't commit your project's Package.resolved file

don't you use any third party spm in your app? if yes, you need to commit the Package.resolved to remote atleast for the main project's spm packages.