Custom directory locations for SMP, how to tell Xcode

I'm starting to use SPM in a CI environment, and I'd like to keep the packages cached / under source control. I've started successfully from Fastlane, by setting the cloned_source_packages_path for my build_ios_app calls.

However, I can't figure out how to "teach" my Xcode project (or workspace) to use the same location. My goals are to (a) prevent Xcode from downloading the packages from their hosts into the "traditional" default location on Xcode launch, and (b) have Xcode fetching and compilation use the new location, so that (for example) if one of our devs builds, an Xcode finds an update, it will download the update AND write that into the repo, NOT into the derived data stash, so that we know to check it in for the next run.

Or, am I just barking entirely up the wrong tree? How do people use SPM with a mix of Xcode and CI?

Unfortunate to see no replies more than one year on... Did you ever find a solution @bobgilmore ?

@bobgilmore did you ever manage to work this one out?

A terrible work around, which mostly works, is to set DerivedData to relative in Xcode location settings, and check in the DerivedData/<ProjectName>/SourcePackages directory. It's a little annoying making sure you ignore the other files in DerivedData, but it is a usable workaround until Xcode gives us a better option.

For CI, the fastlane cloned_source_packages_path works as you would hope. Depending on how you've configured SwiftPM, I guess there's the potential for your CI builds and local builds to get out of sync with the dependencies. To avoid this, it's best to resolve to a commit or a specific version of the dependency.