From 6668e7bd0335df80d88159e841049f6e417bbc7f Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 28 Mar 2023 10:06:26 -0700 Subject: [PATCH] Add support to build hermes from a specific commit (#36681) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36681 This change is needed to add some E2E tests on the Hermes repo so that we can test Hermes against iOS other than android. ## Changelog: [Internal][Added] - Add possibility to download Hermes from a specific commit Reviewed By: cortinico Differential Revision: D44460479 fbshipit-source-id: 89c196aa7c38533e4904444f7f17eb3236fc6356 --- packages/react-native/sdks/hermes-engine/hermes-utils.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/react-native/sdks/hermes-engine/hermes-utils.rb b/packages/react-native/sdks/hermes-engine/hermes-utils.rb index 06f36447d50..26abc7b7076 100644 --- a/packages/react-native/sdks/hermes-engine/hermes-utils.rb +++ b/packages/react-native/sdks/hermes-engine/hermes-utils.rb @@ -35,6 +35,8 @@ def compute_hermes_source(build_from_source, hermestag_file, git, version, build if ENV.has_key?('HERMES_ENGINE_TARBALL_PATH') use_tarball(source) + elsif ENV.has_key?('HERMES_COMMIT') + build_hermes_from_commit(source, git, ENV['HERMES_COMMIT']) elsif build_from_source if File.exist?(hermestag_file) build_from_tagfile(source, git, hermestag_file) @@ -131,6 +133,12 @@ def build_hermes_from_source(source, git) source[:commit] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1`.strip end +def build_hermes_from_commit(source, git, commit) + putsIfPodPresent("[Hermes] Installing hermes-engine from commit #{commit}. It may take a while.") + source[:git] = git + source[:commit] = commit +end + # This function checks that Hermes artifact exists. # As of now it should check it on the Maven repo. #