Skip to content

Commit

Permalink
Hermes: Use arbitrary path to hermes-runtime-darwin if ENV set
Browse files Browse the repository at this point in the history
Differential Revision: D36985477

fbshipit-source-id: c423edfde064cf9d64ba41bcc0698a66d9b96f28
  • Loading branch information
hramos authored and facebook-github-bot committed Jun 8, 2022
1 parent 77e6bff commit cbf204c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
21 changes: 15 additions & 6 deletions scripts/hermes/hermes-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ function copyPodSpec() {
);
}

function isOnAReleaseBranch() {
function isTestingAgainstLocalHermesTarball() {
return 'HERMES_ENGINE_TARBALL_PATH' in process.env;
}

function isOnAReactNativeReleaseBranch() {
try {
let currentBranch = execSync('git rev-parse --abbrev-ref HEAD')
.toString()
Expand All @@ -176,7 +180,7 @@ function isOnAReleaseBranch() {
}
}

function isOnAReleaseTag() {
function isOnAReactNativeReleaseTag() {
try {
// If on a named tag, this method will return the tag name.
// If not, it will throw as the return code is not 0.
Expand All @@ -190,12 +194,17 @@ function isOnAReleaseTag() {
return currentRemote.endsWith('facebook/react-native.git');
}

function shouldBuildHermesFromSource() {
function isRequestingLatestCommitFromHermesMainBranch() {
const hermesTag = readHermesTag();
return hermesTag === DEFAULT_HERMES_TAG;
}

function shouldBuildHermesFromSource() {
return (
isOnAReleaseBranch() ||
isOnAReleaseTag() ||
hermesTag === DEFAULT_HERMES_TAG
!isTestingAgainstLocalHermesTarball() &&
(isOnAReactNativeReleaseBranch() ||
isOnAReactNativeReleaseTag() ||
isRequestingLatestCommitFromHermesMainBranch())
);
}

Expand Down
5 changes: 4 additions & 1 deletion sdks/hermes-engine/hermes-engine.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ currentremote, err = Open3.capture3("git config --get remote.origin.url")
source = {}
git = "https://github.com/facebook/hermes.git"

if version == '1000.0.0'
if ENV.has_key?('HERMES_ENGINE_TARBALL_PATH')
Pod::UI.puts '[Hermes] Using pre-built Hermes binaries from local path.' if Object.const_defined?("Pod::UI")
source[:http] = "file://#{ENV['HERMES_ENGINE_TARBALL_PATH']}"
elsif version == '1000.0.0'
Pod::UI.puts '[Hermes] Hermes needs to be compiled, installing hermes-engine may take a while...'.yellow if Object.const_defined?("Pod::UI")
source[:git] = git
source[:commit] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1`.strip
Expand Down

0 comments on commit cbf204c

Please sign in to comment.