Fix pod install --project-directory=ios failing when Hermes is enabled

This commit is contained in:
Tommy Nguyen
2022-05-12 16:26:38 +02:00
parent 3310ccd2a6
commit 1b22e8a039
+13 -10
View File
@@ -666,11 +666,14 @@ 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}")
sdks_dir = Pod::Config.instance.installation_root.join(react_native_path, "sdks")
download_dir = sdks_dir.join("download")
hermes_dir = sdks_dir.join("hermes")
hermes_tag_file = sdks_dir.join(".hermesversion")
hermes_dir.mkpath
download_dir.mkpath
if (File.exist?(hermes_tag_file))
hermes_tag = File.read(hermes_tag_file).strip
@@ -680,19 +683,19 @@ def downloadAndConfigureHermesSource(react_native_path)
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"
hermes_tarball_path = download_dir.join("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}")
system("curl #{hermes_tarball_url} -Lo #{hermes_tarball_path.to_s}")
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}")
system("tar -zxf #{hermes_tarball_path.to_s} --strip-components=1 --directory #{hermes_dir.to_s}")
# TODO: Integrate this temporary hermes-engine.podspec into the actual one located in facebook/hermes
system("cp #{sdks_dir}/hermes-engine.podspec #{hermes_dir}/hermes-engine.podspec")
FileUtils.cp(sdks_dir.join("hermes-engine.podspec"), hermes_dir.join("hermes-engine.podspec"))
hermes_dir
hermes_dir.relative_path_from(Pod::Config.instance.installation_root).to_s
end
# This provides a post_install workaround for build issues related Xcode 12.5 and Apple Silicon (M1) machines.