Cache Swift Package Manager Dependencies Add via Xcode

Are there any suggestions for how to setup a reliable cache for Swift Package Manager dependencies that are managed directly in Xcode?

Screenshot 2020-07-08 10.09.07

Tracking the lock file ( [appName] .xcodeproj/project.workspace/xcshareddata/swiftpm/Package.resolved) results in frequent build timeouts on Circle. However not tracking the lock file would be non-deterministic as to the version resolved.

Any suggestion would be appreciated as I have not been able to find a good method for cacheing the resolved dependencies as they seem to only be resolved within the DerivedData folder which isn’t easily/reliably shared.

1 Like

Is switching to cocoapods an option?

here is an article on caching SPM dependencies in CI swift package manager and how to cache it with ci

This caches the source but not the built frameworks.

I recently tried to switch from Carthage to SPM and found that my CI build times tripled because it needed to rebuild all my dependencies every time. If anyone has figured out a good caching option to avoid this, I’d love to hear it. Using the source caching option posted above cut the time down slightly, but it’s still rebuilding the libraries.

Did you find any good results? I’m also looking for a way to move from Carthage to SPM and cache the builds on my CI (I’m using bitrise)