Cache prebuilt iOS binaries in ~/Library/Caches/ReactNative#56847
Open
cipolleschi wants to merge 4 commits into
Open
Cache prebuilt iOS binaries in ~/Library/Caches/ReactNative#56847cipolleschi wants to merge 4 commits into
cipolleschi wants to merge 4 commits into
Conversation
Currently, Hermes, ReactNativeDependencies, and ReactNativeCore tarballs are cached only inside the Pods/ directory. This means every clean `pod install` (or deleting the Pods folder) triggers a full re-download from Maven, even if the same version was already downloaded before. This adds a shared cache layer at ~/Library/Caches/ReactNative/. On first download, tarballs are saved to the shared cache. On subsequent pod installs, if the local Pods cache is empty but the shared cache has the tarball, it is copied locally instead of re-downloaded. This benefits: - Clean installs after deleting Pods/ - Multiple projects using the same React Native version - CI environments with a persistent home directory Added descriptive log messages for each scenario (local hit, shared cache hit, cache miss + download) to aid debugging.
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D105315202. |
cortinico
requested changes
May 15, 2026
Contributor
cortinico
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Fetches the .sha1 checksum from Maven for each downloaded tarball and validates file integrity at two points: 1. When reading from the shared cache: if the cached file's SHA1 doesn't match Maven's, it is treated as corrupted and re-downloaded, replacing the stale cache entry. 2. After a fresh download: validates the download succeeded correctly before saving to the shared cache. If verification fails, the file is not cached (but still used locally, as CocoaPods will re-extract it). If Maven doesn't serve a .sha1 for a given artifact (e.g. some nightly builds), validation is skipped gracefully.
Moves shared_cache_dir, fetch_maven_sha1, and validate_tarball into ReactNativePodsUtils in utils.rb to eliminate duplication across hermes-utils.rb, rndependencies.rb, and rncore.rb.
hermes-utils.rb cannot use require_relative to utils.rb because the folder structure differs between the monorepo and published npm package. Instead, hermes-utils.rb gets its own copy of shared_cache_dir, fetch_maven_sha1, and validate_hermes_tarball. Also adds explicit "Verifying checksum for cached/downloaded ..." log lines in all three download functions so the verification step is visible in pod install output.
cortinico
approved these changes
May 15, 2026
Contributor
cortinico
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Adds a shared cache layer at
~/Library/Caches/ReactNative/for prebuilt iOS tarballs(Hermes, ReactNativeDependencies, ReactNativeCore).
Pods artifacts dir and the shared cache.
pod installruns, if the local Podscache is empty but the shared cache has the tarball for
that version, it is copied locally instead of
re-downloaded from Maven.
Pods hit, shared cache hit, and cache miss (download).
This avoids redundant downloads when:
Changelog:
[IOS] [CHANGED] - Cache prebuilt iOS binaries (Hermes,
ReactNativeDependencies, ReactNativeCore) in
~/Library/Caches/ReactNative to avoid redundant downloads
across pod installs
Test Plan:
Cold start ==> Downloading
Warn shared cache, Empty Pods dir ==> Copy
Warm Cache, Pods folder populated ==> Nothing happens