Skip to content

Commit 1b22e8a

Browse files
committed
Fix pod install --project-directory=ios failing when Hermes is enabled
1 parent 3310ccd commit 1b22e8a

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

scripts/react_native_pods.rb

+13-10
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,14 @@ def use_react_native_codegen!(spec, options={})
666666

667667
def downloadAndConfigureHermesSource(react_native_path)
668668
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}")
669+
670+
sdks_dir = Pod::Config.instance.installation_root.join(react_native_path, "sdks")
671+
download_dir = sdks_dir.join("download")
672+
hermes_dir = sdks_dir.join("hermes")
673+
hermes_tag_file = sdks_dir.join(".hermesversion")
674+
675+
hermes_dir.mkpath
676+
download_dir.mkpath
674677

675678
if (File.exist?(hermes_tag_file))
676679
hermes_tag = File.read(hermes_tag_file).strip
@@ -680,19 +683,19 @@ def downloadAndConfigureHermesSource(react_native_path)
680683

681684
hermes_tarball_url = hermes_tarball_base_url + hermes_tag
682685
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"
686+
hermes_tarball_path = download_dir.join("hermes-#{hermes_tag_sha}.tar.gz")
684687

685688
if (!File.exist?(hermes_tarball_path))
686689
Pod::UI.puts "[Hermes] Downloading Hermes source code..."
687-
system("curl #{hermes_tarball_url} -Lo #{hermes_tarball_path}")
690+
system("curl #{hermes_tarball_url} -Lo #{hermes_tarball_path.to_s}")
688691
end
689692
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}")
693+
system("tar -zxf #{hermes_tarball_path.to_s} --strip-components=1 --directory #{hermes_dir.to_s}")
691694

692695
# TODO: Integrate this temporary hermes-engine.podspec into the actual one located in facebook/hermes
693-
system("cp #{sdks_dir}/hermes-engine.podspec #{hermes_dir}/hermes-engine.podspec")
696+
FileUtils.cp(sdks_dir.join("hermes-engine.podspec"), hermes_dir.join("hermes-engine.podspec"))
694697

695-
hermes_dir
698+
hermes_dir.relative_path_from(Pod::Config.instance.installation_root).to_s
696699
end
697700

698701
# This provides a post_install workaround for build issues related Xcode 12.5 and Apple Silicon (M1) machines.

0 commit comments

Comments
 (0)