How to cache Xamarin dependencies

Setup

  1. Put the Cache:Pull step after the Git Clone and before the NuGet restore step and of course the Xamarin Archive step.
  2. Put the Cache:Push step to the very end of the Workflow
  3. Select the Cache:Push step and specify the following paths for caching (Cache paths input):
$HOME/.local/share/Xamarin
src/packages
src/Components

If your source is not in src then you should specify the correct path, the path where you find the folders packages and components. components is only if you use Xamarin Components

The $HOME/.local/share/Xamarin will cache everything related to sources needed to build iOS, Android releated packages.

Example workflow

example:
  steps:
  - git-clone: {}
  - cache-pull: {}
  - xamarin-user-management: {}
  - certificate-and-profile-installer: {}
  - nuget-restore: {}
  - xamarin-archive: {}
  - cache-push:
      inputs:
      - cache_paths: |-
          $BITRISE_CACHE_DIR
          $HOME/.local/share/Xamarin
          src/packages
          src/Components

For more information about the Bitrise Build Cache see the DevCenter.

3 Likes

Awesome, thank you for the #how-to guide!!

I changed one little thing in the guide: replaced /Users/vagrant/ with $HOME/, as it’s more future proof :wink:

1 Like