Repository navigation
Make hermes-engine podspec checksum deterministic when building from source - #60348
Open
JagguDada01 wants to merge 1 commit into
Open
JagguDada01 wants to merge 1 commit into
JagguDada01 wants to merge 1 commit into
Conversation
This branch has not been deployed
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:
Makes the
hermes-enginepodspec deterministic across checkouts and machines when building Hermes from source (RCT_BUILD_HERMES_FROM_SOURCE=true).Problem
When
RCT_BUILD_HERMES_FROM_SOURCE=trueis used,pod installwrites ahermes-enginechecksum intoios/Podfile.lock(the SHA1 ofPods/Local Podspecs/hermes-engine.podspec.json) that varies across developer machines, worktrees, and CI runners, causing unnecessaryPodfile.lockchurn and breakingpod 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:spec.prepare_commandinterpolated the absolutereact_native_pathto sourcecreate-dummy-hermes-xcframework.sh.spec.script_phasesinterpolatedCMAKE_BINARY = Pod::Executable::which!('cmake')(e.g./opt/homebrew/bin/cmakevs/usr/local/bin/cmake) into both[RN] [1] Build Hermescand[RN] [2] Build Hermesscripts.Solution
create-dummy-hermes-xcframework.shinline viaFile.read(File.join(react_native_path, "sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh"))(matchingthird-party-podspecs/glog.podspec), eliminating the checkout path fromspec.prepare_command.Pod::Executable::which!('cmake')as apod install-time check without baking its path intospec.script_phases, and resolveCMAKE_BINARYat Xcode build time (after sourcingwith-environment.sh, preserving anyCMAKE_BINARYfrom.xcode.env/.xcode.env.local, checking$PATH, and falling back to standard macOScmakeinstall locations such as/opt/homebrew/bin).packages/react-native/scripts/cocoapods/__tests__/hermes_podspec-test.rb.Fixes #58889
Changelog:
[IOS] [FIXED] - Make
hermes-enginepodspec checksum deterministic across checkout paths andcmakelocations when building Hermes from sourceTest Plan:
packages/react-native/scripts/cocoapods/__tests__/hermes_podspec-test.rbalong 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).hermes-engine.podspecevaluated from two distinct checkout paths and with two differentcmakebinary paths (/opt/homebrew/bin/cmakevs/usr/local/bin/cmake) produces identical podspec output.prepare_commandandscript_phasespassbash -n, preserveCMAKE_BINARYoverrides from.xcode.env, resolvecmakefromPATH, and fall back to/opt/homebrew/bin/cmakewhen stripped fromPATH.hermes-engine.podspecevaluates cleanly whenPod::Executableis undefined.create-dummy-hermes-xcframework.shexecutes cleanly viabash -cin a temporary directory and produces the expected dummyhermesvm.frameworkslices.(Full CocoaPods
bundle exec pod install/xcodebuildwas not run locally ascocoapodsgem and iOS simulator runtimes are not installed in this environment; CI iOS workflows will verify the full Xcode/CocoaPods build.)