SPM cache path fix for Build Cache for Xcode

Description

We fixed an issue where Swift Package Manager dependencies could still be downloaded from origin on every build when using Build Cache for Xcode.

What was wrong

Build Cache for Xcode relocates Xcode DerivedData to a Bitrise-managed path. Since Swift Package Manager checkouts live inside DerivedData, they moved too.

Until now, generic SPM cache setups often still targeted the default Xcode DerivedData location, so caches could restore successfully but never actually be read by the build. As a result, packages were re-resolved and downloaded again.

Customers who pass their own -derivedDataPath to xcodebuild were not affected.

What we changed

On 2026-08-03, we shipped:

  • Build Cache CLI v3.4.0, which now exports BITRISE_XCODE_DERIVED_DATA_PATH
  • Build Cache for Xcode 0.17.0
  • save-spm-cache 1.4.0, which now automatically uses the relocated DerivedData path

We also updated package resolution commands so they use the same SPM checkout location as the build itself.

What you need to do

If you use save-spm-cache + restore-spm-cache

No workflow change is needed.

Just use save-spm-cache 1.4.0 or newer. If you’re on save-spm-cache@1, you’ll get this automatically.

If you use generic save-cache / restore-cache for SPM

Action required: update your save-cache Step.

Set the paths input to: $BITRISE_XCODE_DERIVED_DATA_PATH/*/SourcePackages

You do not need to change restore-cache.

Important: you must also either:

  • delete the old cache entry from your app’s cache management page, or
  • bump the cache key, for example by adding -v2

Without this, the old archive can keep restoring to the old location, and the fix will appear to do nothing.

If you pass your own -derivedDataPath to xcodebuild

Nothing to do — you were never affected.

Why This Matters

This fix enables SPM caches to be restored into the location your Xcode build actually uses.

Bottom line: If you use generic save-cache / restore-cache for Swift packages together with Build Cache for Xcode, update your save-cache path and clear or version your old cache entry to start benefiting from the fix.