mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Hermes: Use prepare-hermes-for-build in CocoaPods (#33825)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6c2e34be0b
commit
aaa01f7710
@@ -102,9 +102,9 @@ def use_react_native! (options={})
|
||||
end
|
||||
|
||||
if hermes_enabled
|
||||
system("(cd #{prefix} && node scripts/hermes/prepare-hermes-for-build)")
|
||||
pod 'React-hermes', :path => "#{prefix}/ReactCommon/hermes"
|
||||
hermes_source_path = downloadAndConfigureHermesSource(prefix)
|
||||
pod 'hermes-engine', :path => "#{hermes_source_path}/hermes-engine.podspec"
|
||||
pod 'hermes-engine', :path => "#{prefix}/sdks/hermes/hermes-engine.podspec"
|
||||
pod 'libevent', '~> 2.1.12'
|
||||
end
|
||||
|
||||
@@ -605,38 +605,6 @@ def use_react_native_codegen!(spec, options={})
|
||||
}
|
||||
end
|
||||
|
||||
def downloadAndConfigureHermesSource(react_native_path)
|
||||
hermes_tarball_base_url = "https://github.com/facebook/hermes/tarball/"
|
||||
sdks_dir = "#{react_native_path}/sdks"
|
||||
download_dir = "#{sdks_dir}/download"
|
||||
hermes_dir = "#{sdks_dir}/hermes"
|
||||
hermes_tag_file = "#{sdks_dir}/.hermesversion"
|
||||
system("mkdir -p #{hermes_dir} #{download_dir}")
|
||||
|
||||
if (File.exist?(hermes_tag_file))
|
||||
hermes_tag = File.read(hermes_tag_file).strip
|
||||
else
|
||||
hermes_tag = "main"
|
||||
end
|
||||
|
||||
hermes_tarball_url = hermes_tarball_base_url + hermes_tag
|
||||
hermes_tag_sha = %x[git ls-remote https://github.com/facebook/hermes #{hermes_tag} | cut -f 1].strip
|
||||
hermes_tarball_path = "#{download_dir}/hermes-#{hermes_tag_sha}.tar.gz"
|
||||
|
||||
if (!File.exist?(hermes_tarball_path))
|
||||
Pod::UI.puts "[Hermes] Downloading Hermes source code..."
|
||||
system("curl #{hermes_tarball_url} -Lo #{hermes_tarball_path}")
|
||||
end
|
||||
Pod::UI.puts "[Hermes] Extracting Hermes tarball (#{hermes_tag_sha.slice(0,6)})"
|
||||
system("tar -zxf #{hermes_tarball_path} --strip-components=1 --directory #{hermes_dir}")
|
||||
|
||||
# Use React Native's own scripts to build Hermes
|
||||
system("cp #{sdks_dir}/hermes-engine/hermes-engine.podspec #{hermes_dir}/hermes-engine.podspec")
|
||||
system("cp #{sdks_dir}/hermes-engine/utils/* #{hermes_dir}/utils/.")
|
||||
|
||||
hermes_dir
|
||||
end
|
||||
|
||||
# This provides a post_install workaround for build issues related Xcode 12.5 and Apple Silicon (M1) machines.
|
||||
# Call this in the app's main Podfile's post_install hook.
|
||||
# See https://github.com/facebook/react-native/issues/31480#issuecomment-902912841 for more context.
|
||||
|
||||
Reference in New Issue
Block a user