Skip to content

Commit 612dbb3

Browse files
hramosfortmarek
authored andcommitted
Hermes: Use prepare-hermes-for-build in CocoaPods (#33825)
Summary: Pull Request resolved: #33825 Updates the CocoaPods build scripts to consume the prepare-hermes-for-build script, replacing the now redundant set of Ruby code that would previously set the filesystem up. Changelog: [iOS] [Changed] - When building Hermes from source, the filesystem will now be prepared using the new hermes-utils.js scripts, outside of CocoaPods Reviewed By: cortinico Differential Revision: D36336633 fbshipit-source-id: a4506db80c039529b14b0290d2f0b54fae78dcf2
1 parent 78b3842 commit 612dbb3

1 file changed

Lines changed: 2 additions & 34 deletions

File tree

scripts/react_native_pods.rb

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ def use_react_native! (options={})
109109
end
110110

111111
if hermes_enabled
112+
system("(cd #{prefix} && node scripts/hermes/prepare-hermes-for-build)")
112113
pod 'React-hermes', :path => "#{prefix}/ReactCommon/hermes"
113-
hermes_source_path = downloadAndConfigureHermesSource(prefix)
114-
pod 'hermes-engine', :path => "#{hermes_source_path}/hermes-engine.podspec"
114+
pod 'hermes-engine', :path => "#{prefix}/sdks/hermes/hermes-engine.podspec"
115115
pod 'libevent', '~> 2.1.12'
116116
end
117117

@@ -664,38 +664,6 @@ def use_react_native_codegen!(spec, options={})
664664
}
665665
end
666666

667-
def downloadAndConfigureHermesSource(react_native_path)
668-
hermes_tarball_base_url = "https://github.com/facebook/hermes/tarball/"
669-
sdks_dir = "#{react_native_path}/sdks"
670-
download_dir = "#{sdks_dir}/download"
671-
hermes_dir = "#{sdks_dir}/hermes"
672-
hermes_tag_file = "#{sdks_dir}/.hermesversion"
673-
system("mkdir -p #{hermes_dir} #{download_dir}")
674-
675-
if (File.exist?(hermes_tag_file))
676-
hermes_tag = File.read(hermes_tag_file).strip
677-
else
678-
hermes_tag = "main"
679-
end
680-
681-
hermes_tarball_url = hermes_tarball_base_url + hermes_tag
682-
hermes_tag_sha = %x[git ls-remote https://github.com/facebook/hermes #{hermes_tag} | cut -f 1].strip
683-
hermes_tarball_path = "#{download_dir}/hermes-#{hermes_tag_sha}.tar.gz"
684-
685-
if (!File.exist?(hermes_tarball_path))
686-
Pod::UI.puts "[Hermes] Downloading Hermes source code..."
687-
system("curl #{hermes_tarball_url} -Lo #{hermes_tarball_path}")
688-
end
689-
Pod::UI.puts "[Hermes] Extracting Hermes tarball (#{hermes_tag_sha.slice(0,6)})"
690-
system("tar -zxf #{hermes_tarball_path} --strip-components=1 --directory #{hermes_dir}")
691-
692-
# Use React Native's own scripts to build Hermes
693-
system("cp #{sdks_dir}/hermes-engine/hermes-engine.podspec #{hermes_dir}/hermes-engine.podspec")
694-
system("cp #{sdks_dir}/hermes-engine/utils/* #{hermes_dir}/utils/.")
695-
696-
hermes_dir
697-
end
698-
699667
# This provides a post_install workaround for build issues related Xcode 12.5 and Apple Silicon (M1) machines.
700668
# Call this in the app's main Podfile's post_install hook.
701669
# See https://github.com/facebook/react-native/issues/31480#issuecomment-902912841 for more context.

0 commit comments

Comments
 (0)