44# LICENSE file in the root directory of this source tree.
55
66require "json"
7+ require "open3"
78
89# sdks/hermesc/osx-bin/ImportHermesc.cmake
910import_hermesc_file = File . join ( __dir__ , ".." , "hermesc" , "osx-bin" , "ImportHermesc.cmake" )
@@ -13,8 +14,10 @@ package_file = File.join(__dir__, "..", "..", "package.json")
1314package = JSON . parse ( File . read ( package_file ) )
1415version = package [ 'version' ]
1516
16- currentbranch = `git rev-parse --abbrev-ref HEAD` . strip
17- currentremote = `git config --get remote.origin.url` . strip
17+ # We need to check the current git branch/remote to verify if
18+ # we're on a React Native release branch to actually build Hermes.
19+ currentbranch , err = Open3 . capture3 ( "git rev-parse --abbrev-ref HEAD" )
20+ currentremote , err = Open3 . capture3 ( "git config --get remote.origin.url" )
1821
1922source = { }
2023git = "https://github.com/facebook/hermes.git"
@@ -23,7 +26,7 @@ if version == '1000.0.0'
2326 Pod ::UI . puts '[Hermes] Hermes needs to be compiled, installing hermes-engine may take a while...' . yellow if Object . const_defined? ( "Pod::UI" )
2427 source [ :git ] = git
2528 source [ :commit ] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1` . strip
26- elsif currentremote . end_with? ( "facebook/react-native.git" ) and currentbranch . end_with? ( "-stable" )
29+ elsif currentremote . strip . end_with? ( "facebook/react-native.git" ) and currentbranch . strip . end_with? ( "-stable" )
2730 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" )
2831 source [ :git ] = git
2932 source [ :commit ] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1` . strip
0 commit comments