Skip to content

Commit 889578a

Browse files
hramosfacebook-github-bot
authored andcommittedMar 10, 2022
Download Hermes tarball during pod install
Summary: Downloads a tarball of the Hermes source code when `pod install` is run. If the current release is pinned to a Hermes tag, it will use that specific tag, otherwise the latest Hermes commit will be used. # Changelog: [Internal] Reviewed By: cortinico Differential Revision: D34629595 fbshipit-source-id: 5f36af4a43bc2d137dfd702082558ab9d0191140
1 parent 52aee50 commit 889578a

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed
 

‎.gitignore

+5-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ package-lock.json
7272
# OS X
7373
.DS_Store
7474

75-
# Hermes
76-
/sdks/hermes
77-
/sdks/download
78-
7975
# Test generated files
8076
/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
8177
*.js.meta
@@ -116,6 +112,11 @@ package-lock.json
116112
/ReactCommon/react/renderer/components/rncore/
117113
/packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec*
118114

115+
# Additional SDKs
116+
/sdks/.hermesversion
117+
/sdks/hermes
118+
/sdks/download
119+
119120
# Visual studio
120121
.vscode
121122
.vs

‎scripts/react_native_pods.rb

+24-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def use_react_native! (options={})
111111
pod 'React-hermes', :path => "#{prefix}/ReactCommon/hermes"
112112

113113
if ENV['BUILD_HERMES_SOURCE'] == '1'
114-
hermes_source_path = locatePathToHermesSource!(prefix)
114+
hermes_source_path = downloadAndConfigureHermesSource(prefix)
115115
pod 'hermes-engine', :path => "#{hermes_source_path}/hermes-engine.podspec"
116116
else
117117
pod 'hermes-engine', '~> 0.11.0'
@@ -629,6 +629,29 @@ def use_react_native_codegen!(spec, options={})
629629
}
630630
end
631631

632+
def downloadAndConfigureHermesSource(react_native_path)
633+
hermes_tarball_base_url = "https://github.com/facebook/hermes/tarball/"
634+
sdks_dir = "#{react_native_path}/sdks"
635+
download_dir = "#{sdks_dir}/download"
636+
hermes_dir = "#{sdks_dir}/hermes"
637+
hermes_tag_file = "#{sdks_dir}/.hermesversion"
638+
tarball_path = "#{download_dir}/hermes.tar.gz"
639+
640+
system("mkdir -p #{hermes_dir} #{download_dir}")
641+
642+
if(File.exist?(hermes_tag_file))
643+
hermes_tag = file_data = File.read(hermes_tag_file).strip
644+
hermes_tarball_url = hermes_tarball_base_url + hermes_tag
645+
else
646+
hermes_tarball_url = hermes_tarball_base_url + "main"
647+
end
648+
649+
system("wget --timestamping -O #{tarball_path} #{hermes_tarball_url}")
650+
system("tar -xzf #{tarball_path} --strip-components=1 -C #{hermes_dir}")
651+
652+
hermes_dir
653+
end
654+
632655
def locatePathToHermesSource!(react_native_path)
633656
return if ENV['BUILD_HERMES_SOURCE'] != '1'
634657

0 commit comments

Comments
 (0)
Please sign in to comment.