Skip to content

Let Android release bundles skip --reset-cache - #59547

Open
lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-59543-release-bundle-reset-cache
Open

lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-59543-release-bundle-reset-cache

Conversation

@lazerg

@lazerg lazerg commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Summary:

BundleHermesCTask always passes --reset-cache to the bundle command, and nothing in the react {} block can turn it off. Metro's default cache lives in os.tmpdir()/metro-cache, which every Metro on the machine shares. So each Android release bundle wipes the cache of other projects and dev servers, and on Windows it can fail with ENOTEMPTY when another Metro writes into that folder during the reset.

This adds a resetCache property to the react {} extension. It defaults to true, so builds work as before, and resetCache = false drops the flag from the bundle command.

Fixes #59543

Changelog:

[ANDROID] [ADDED] - Add resetCache to the react {} Gradle extension to let release bundles keep the Metro cache

Test Plan:

Added getBundleCommand_withResetCacheDisabled_returnsCommandWithoutResetCache to BundleHermesCTaskTest, and the existing command tests still expect --reset-cache by default. ./gradlew :react-native-gradle-plugin:test --tests 'com.facebook.react.tasks.BundleHermesCTaskTest' passes (17 tests), and ktfmt is clean on the changed files.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 27, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 27, 2026
@lazerg

lazerg commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

The build_android failure isn't from this change. It also fails on main since the Kotlin 2.3.21 update (#59535): :gradle-plugin:shared:compileKotlin warns that API version 2.0 is deprecated, and -Werror turns that warning into an error.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Every Android release bundle empties the machine-wide Metro cache (--reset-cache)

1 participant