Skip to content

Commit

Permalink
[docs] Update caching docs to reflect new CocoaPods network cache and…
Browse files Browse the repository at this point in the history
… other changes (expo#21971)
  • Loading branch information
brentvatne authored Apr 4, 2023
1 parent 0cf2d5a commit 253a319
Showing 1 changed file with 6 additions and 33 deletions.
39 changes: 6 additions & 33 deletions docs/pages/build-reference/caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ Before a build job can begin compiling your project, all project dependencies ne

The `cache` field on build profiles in [eas.json](/build/eas-json) can be used to configure caching for specific files and directories. Specified files will be saved to persistent storage after a successful build and restored on subsequent builds after the JavaScript dependencies are installed. Restoring does not overwrite existing files. Changing the `cache.key` value will invalidate the cache. Changing any other property of the `cache` object will also invalidate the cache.

The caching implementation is built on top of Amazon S3, and it's not fast enough to give you any benefit from caching **node_modules** or CocoaPods; it's intended only for files that require significant computation to generate, for example, compilation results (both final binaries and any intermediate files).

## JavaScript dependencies

EAS Build runs an npm cache server that can speed up downloading JavaScript dependencies for your build jobs. Projects that are using npm or yarn v2 will use the cache by default, but yarn v1 will require that you apply this [workaround](/build-reference/npm-cache-with-yarn).

It is not yet possible to save and restore **node_modules** between builds.

To disable using our npm cache server for your builds set `EAS_BUILD_DISABLE_NPM_CACHE` env variable value to `"1"` in **eas.json**.
To disable using our npm cache server for your builds set the `EAS_BUILD_DISABLE_NPM_CACHE` env variable value to `"1"` in **eas.json**.

{/* prettier-ignore */}
```json eas.json
Expand Down Expand Up @@ -49,7 +45,7 @@ Currently, we are caching:
- `jcenter` - [https://jcenter.bintray.com/](https://jcenter.bintray.com/)
- `plugins` - [https://plugins.gradle.org/m2/](https://plugins.gradle.org/m2/)

To disable using our Maven cache server for your builds set `EAS_BUILD_DISABLE_MAVEN_CACHE` env variable value to `"1"` in **eas.json**.
To disable using our Maven cache server for your builds set the `EAS_BUILD_DISABLE_MAVEN_CACHE` env variable value to `"1"` in **eas.json**.

{/* prettier-ignore */}
```json eas.json
Expand All @@ -70,40 +66,17 @@ To disable using our Maven cache server for your builds set `EAS_BUILD_DISABLE_M

## iOS dependencies

EAS Build caches the **Podfile.lock** file by default. This provides consistent results across managed app builds.

Additionally, EAS Build runs a CocoaPods cache server that can speed up downloading iOS dependencies for your build jobs in most cases. It also makes the service more resilient to CocoaPods CDN outages.

The cache server is configured to cache almost all the pods served from the official CocoaPods CDN, minus a few exceptions that our cache server can't handle. These exceptions can be found on the [blacklist](https://github.com/expo/eas-build/blob/main/packages/cocoapods-nexus-plugin/lib/cocoapods_plugin.rb#L4) of our custom CocoaPods plugin. These are fetched directly from the CDN instead of being fetched through our cache server.

This is an experimental feature that requires explicit opt-in. You can **enable** it by setting the `EAS_BUILD_ENABLE_COCOAPODS_CACHE` env variable value to `"1"` in **eas.json**.

{/* prettier-ignore */}
```json eas.json
{
"build": {
"production": {
"env": {
"EAS_BUILD_ENABLE_COCOAPODS_CACHE": "1"
/* @hide ... */ /* @end */
}
/* @hide ... */ /* @end */
}
/* @hide ... */ /* @end */
}
/* @hide ... */ /* @end */
}
```
EAS Build serves most CocoaPods artifacts from a cache server. This improves consistency of `pod install` times while also generally improving speed. The cache will be bypassed automatically if you provide your own **.netrc** or **.curlrc** files.

To explicitly disable using our CocoaPods cache server for your builds, set the `EAS_BUILD_ENABLE_COCOAPODS_CACHE` env variable value to `"0"` in **eas.json**.
To using our CocoaPods cache server for your builds set the `EAS_BUILD_DISABLE_COCOAPODS_CACHE` env variable value to `"1"` in **eas.json**.

{/* prettier-ignore */}
```json eas.json
{
"build": {
"production": {
"env": {
"EAS_BUILD_ENABLE_COCOAPODS_CACHE": "0"
"EAS_BUILD_DISABLE_COCOAPODS_CACHE": "1"
/* @hide ... */ /* @end */
}
/* @hide ... */ /* @end */
Expand All @@ -112,4 +85,4 @@ To explicitly disable using our CocoaPods cache server for your builds, set the
}
/* @hide ... */ /* @end */
}
```
```

0 comments on commit 253a319

Please sign in to comment.