Skip to content

Commit aaa01f7

Browse files
hramosfacebook-github-bot
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 6c2e34b commit aaa01f7

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

scripts/react_native_pods.rb

+2-34
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ def use_react_native! (options={})
102102
end
103103

104104
if hermes_enabled
105+
system("(cd #{prefix} && node scripts/hermes/prepare-hermes-for-build)")
105106
pod 'React-hermes', :path => "#{prefix}/ReactCommon/hermes"
106-
hermes_source_path = downloadAndConfigureHermesSource(prefix)
107-
pod 'hermes-engine', :path => "#{hermes_source_path}/hermes-engine.podspec"
107+
pod 'hermes-engine', :path => "#{prefix}/sdks/hermes/hermes-engine.podspec"
108108
pod 'libevent', '~> 2.1.12'
109109
end
110110

@@ -605,38 +605,6 @@ def use_react_native_codegen!(spec, options={})
605605
}
606606
end
607607

608-
def downloadAndConfigureHermesSource(react_native_path)
609-
hermes_tarball_base_url = "https://github.com/facebook/hermes/tarball/"
610-
sdks_dir = "#{react_native_path}/sdks"
611-
download_dir = "#{sdks_dir}/download"
612-
hermes_dir = "#{sdks_dir}/hermes"
613-
hermes_tag_file = "#{sdks_dir}/.hermesversion"
614-
system("mkdir -p #{hermes_dir} #{download_dir}")
615-
616-
if (File.exist?(hermes_tag_file))
617-
hermes_tag = File.read(hermes_tag_file).strip
618-
else
619-
hermes_tag = "main"
620-
end
621-
622-
hermes_tarball_url = hermes_tarball_base_url + hermes_tag
623-
hermes_tag_sha = %x[git ls-remote https://github.com/facebook/hermes #{hermes_tag} | cut -f 1].strip
624-
hermes_tarball_path = "#{download_dir}/hermes-#{hermes_tag_sha}.tar.gz"
625-
626-
if (!File.exist?(hermes_tarball_path))
627-
Pod::UI.puts "[Hermes] Downloading Hermes source code..."
628-
system("curl #{hermes_tarball_url} -Lo #{hermes_tarball_path}")
629-
end
630-
Pod::UI.puts "[Hermes] Extracting Hermes tarball (#{hermes_tag_sha.slice(0,6)})"
631-
system("tar -zxf #{hermes_tarball_path} --strip-components=1 --directory #{hermes_dir}")
632-
633-
# Use React Native's own scripts to build Hermes
634-
system("cp #{sdks_dir}/hermes-engine/hermes-engine.podspec #{hermes_dir}/hermes-engine.podspec")
635-
system("cp #{sdks_dir}/hermes-engine/utils/* #{hermes_dir}/utils/.")
636-
637-
hermes_dir
638-
end
639-
640608
# This provides a post_install workaround for build issues related Xcode 12.5 and Apple Silicon (M1) machines.
641609
# Call this in the app's main Podfile's post_install hook.
642610
# See https://github.com/facebook/react-native/issues/31480#issuecomment-902912841 for more context.

0 commit comments

Comments
 (0)