Skip to content

Fix debug Hermes being embedded in iOS Release builds after hermes-engine pod re-install#57574

Closed
tjzel wants to merge 2 commits into
react:mainfrom
tjzel:fix/hermes-engine-stale-last-build-configuration
Closed

Fix debug Hermes being embedded in iOS Release builds after hermes-engine pod re-install#57574
tjzel wants to merge 2 commits into
react:mainfrom
tjzel:fix/hermes-engine-stale-last-build-configuration

Conversation

@tjzel

@tjzel tjzel commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary:

The hermes-engine pod is always installed from the debug tarball; the debug/release selection is deferred to a build phase that runs sdks/hermes-engine/utils/replace_hermes_version.js. The script tracks which variant currently sits in Pods/hermes-engine through a .last_build_configuration marker at the Pods root and skips the swap when the marker matches the requested configuration.

Whenever CocoaPods re-installs hermes-engine, the engine resets to the debug variant while the marker still claims Release. The next Release build takes the "Same config of the previous build" path and silently embeds the debug hermesvm into the Release app.

I moved the marker inside Pods/hermes-engine/ so a pod re-install destroys it together with the engine it describes and the next build re-runs the swap — the same pattern replace-rncore-version.js and replace_dependencies_version.js already use for their prebuilts.

I also added some assertions.

Changelog:

[IOS] [FIXED] - Fix debug Hermes being silently embedded in Release builds after the hermes-engine pod is re-installed

Test Plan:

Reproduced on react-native@0.86.0 before the change: Release build, then rm -rf ios/Pods/hermes-engine && pod install, then Release build again — the app's embedded hermesvm is the debug binary (nm -gU -arch arm64 hermesvm | grep -c CDPDebugAPI prints 6, ~12.2 MB; the release binary prints 0, ~10.2 MB) while the marker says Release.

@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 Jul 16, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner labels Jul 16, 2026
@tjzel
tjzel marked this pull request as ready for review July 16, 2026 08:38
@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 Jul 16, 2026
@meta-codesync

meta-codesync Bot commented Jul 16, 2026

Copy link
Copy Markdown

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D112308961.

@cortinico cortinico left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync meta-codesync Bot closed this in 62a2b38 Jul 16, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Jul 16, 2026
@meta-codesync

meta-codesync Bot commented Jul 16, 2026

Copy link
Copy Markdown

@cipolleschi merged this pull request in 62a2b38.

react-native-bot pushed a commit that referenced this pull request Jul 16, 2026
…gine pod re-install (#57574)

Summary:
The `hermes-engine` pod is always installed from the debug tarball; the debug/release selection is deferred to a build phase that runs `sdks/hermes-engine/utils/replace_hermes_version.js`. The script tracks which variant currently sits in `Pods/hermes-engine` through a `.last_build_configuration` marker at the Pods root and skips the swap when the marker matches the requested configuration.

Whenever CocoaPods re-installs `hermes-engine`, the engine resets to the debug variant while the marker still claims `Release`. The next Release build takes the "Same config of the previous build" path and silently embeds the debug `hermesvm` into the Release app.

I moved the marker inside `Pods/hermes-engine/` so a pod re-install destroys it together with the engine it describes and the next build re-runs the swap — the same pattern `replace-rncore-version.js` and `replace_dependencies_version.js` already use for their prebuilts.

I also added some assertions.

## Changelog:

[IOS] [FIXED] - Fix debug Hermes being silently embedded in Release builds after the hermes-engine pod is re-installed

Pull Request resolved: #57574

Test Plan: Reproduced on `react-native@0.86.0` before the change: Release build, then `rm -rf ios/Pods/hermes-engine && pod install`, then Release build again — the app's embedded `hermesvm` is the debug binary (`nm -gU -arch arm64 hermesvm | grep -c CDPDebugAPI` prints 6, ~12.2 MB; the release binary prints 0, ~10.2 MB) while the marker says `Release`.

Reviewed By: cortinico

Differential Revision: D112308961

Pulled By: cipolleschi

fbshipit-source-id: 2f4111ac7030fcedd888d91c6eb2dd034dc13c0d
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. Merged This PR has been merged. p: Software Mansion Partner: Software Mansion Partner 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.

3 participants