Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Make hermes-engine podspec checksum deterministic when building from source - #60348

Open
JagguDada01 wants to merge 1 commit into
react:mainfrom
JagguDada01:fix/hermes-podspec-deterministic-checksum
Open

JagguDada01 wants to merge 1 commit into
react:mainfrom
JagguDada01:fix/hermes-podspec-deterministic-checksum

Conversation

@JagguDada01

Copy link
Copy Markdown

Summary:

Makes the hermes-engine podspec deterministic across checkouts and machines when building Hermes from source (RCT_BUILD_HERMES_FROM_SOURCE=true).

Problem

When RCT_BUILD_HERMES_FROM_SOURCE=true is used, pod install writes a hermes-engine checksum into ios/Podfile.lock (the SHA1 of Pods/Local Podspecs/hermes-engine.podspec.json) that varies across developer machines, worktrees, and CI runners, causing unnecessary Podfile.lock churn and breaking pod install --deployment.

Root Cause

In the from-source branch of packages/react-native/sdks/hermes-engine/hermes-engine.podspec, two machine-specific absolute paths were baked into the evaluated podspec:

  1. spec.prepare_command interpolated the absolute react_native_path to source create-dummy-hermes-xcframework.sh.
  2. spec.script_phases interpolated CMAKE_BINARY = Pod::Executable::which!('cmake') (e.g. /opt/homebrew/bin/cmake vs /usr/local/bin/cmake) into both [RN] [1] Build Hermesc and [RN] [2] Build Hermes scripts.

Solution

  1. Read create-dummy-hermes-xcframework.sh inline via File.read(File.join(react_native_path, "sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh")) (matching third-party-podspecs/glog.podspec), eliminating the checkout path from spec.prepare_command.
  2. Keep Pod::Executable::which!('cmake') as a pod install-time check without baking its path into spec.script_phases, and resolve CMAKE_BINARY at Xcode build time (after sourcing with-environment.sh, preserving any CMAKE_BINARY from .xcode.env/.xcode.env.local, checking $PATH, and falling back to standard macOS cmake install locations such as /opt/homebrew/bin).
  3. Add regression tests in packages/react-native/scripts/cocoapods/__tests__/hermes_podspec-test.rb.

Fixes #58889

Changelog:

[IOS] [FIXED] - Make hermes-engine podspec checksum deterministic across checkout paths and cmake locations when building Hermes from source

Test Plan:

  1. Ran packages/react-native/scripts/cocoapods/__tests__/hermes_podspec-test.rb along with sibling Ruby CocoaPods tests (codegen_utils-test.rb, jsengine-test.rb, local_podspec_patch-test.rb, maven_mirror_flag-test.rb, rndependencies-test.rb): 29 tests, 94 assertions, 0 failures, 0 errors (100% passed).
    • Verified hermes-engine.podspec evaluated from two distinct checkout paths and with two different cmake binary paths (/opt/homebrew/bin/cmake vs /usr/local/bin/cmake) produces identical podspec output.
    • Verified prepare_command and script_phases pass bash -n, preserve CMAKE_BINARY overrides from .xcode.env, resolve cmake from PATH, and fall back to /opt/homebrew/bin/cmake when stripped from PATH.
    • Verified hermes-engine.podspec evaluates cleanly when Pod::Executable is undefined.
  2. Verified create-dummy-hermes-xcframework.sh executes cleanly via bash -c in a temporary directory and produces the expected dummy hermesvm.framework slices.

(Full CocoaPods bundle exec pod install / xcodebuild was not run locally as cocoapods gem and iOS simulator runtimes are not installed in this environment; CI iOS workflows will verify the full Xcode/CocoaPods build.)

@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 Nov 27, 2026
@github-actions github-actions Bot added the Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. label Nov 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 Nov 27, 2026

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. Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. 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.

hermes-engine checksum in Podfile.lock changes with the checkout path (Hermes built from source)

1 participant