Hermes pod: change logic to use the hermes tag to set the pod source correctly (#34221)

Summary:
This fix is necessarly to ensure that when working on the codebase in the `0.XX-stable` branches (ex. when you are working on a release) the Hermes podfile is correctly set against the right commit for that branch, and not latest commit from main branch of Hermes repo.

I didn't add a check to verify that the file `.hermesversion` exists because I think it's safe to assume that the file and the tag correctly exists when this step (doing a pod install on the `0.XX-stable` branch).

Once this is merged, we need to cherry pick it on both the 0.69 and 0.70 branches

## Changelog

[iOS] [Fixed] - Hermes pod: change logic to use the hermes tag to set the pod source correctly

Pull Request resolved: https://github.com/facebook/react-native/pull/34221

Test Plan:
* git clone the repo
* checkout 0.69-stable branch
* follow https://reactnative.dev/contributing/release-testing
* without this commit, when testing RNTester + iOS + Hermes the app will insta-crash on opening
* with it, the app gets build successfully

Reviewed By: cortinico

Differential Revision: D37957660

Pulled By: cipolleschi

fbshipit-source-id: 4e50099ed712b1ad8e6439822e3f530142982c1b
This commit is contained in:
Lorenzo Sciandra 2022-07-19 07:34:18 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 1d997ce6d6
Коммит 46a9edc854
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -31,8 +31,10 @@ elsif version == '1000.0.0'
source[:commit] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1`.strip
elsif currentremote.strip.end_with?("facebook/react-native.git") and currentbranch.strip.end_with?("-stable")
Pod::UI.puts '[Hermes] Detected that you are on a React Native release branch, building Hermes from source...'.yellow if Object.const_defined?("Pod::UI")
hermestag_file = File.join(__dir__, "..", ".hermesversion")
hermestag = File.read(hermestag_file).strip
source[:git] = git
source[:commit] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1`.strip
source[:tag] = hermestag
else
source[:http] = "https://github.com/facebook/react-native/releases/download/v#{version}/hermes-runtime-darwin-v#{version}.tar.gz"
end