From b22970e3cfbe603bffea5b1c3bbf150887e3d7b8 Mon Sep 17 00:00:00 2001 From: Blake Friedman Date: Fri, 23 Aug 2024 09:56:09 -0700 Subject: [PATCH] autolinked package scripts use absolute path (#46186) Summary: A previous attempt at fixing this issue used a relative path (https://github.com/facebook/react-native/issues/45208), this doesn't work if the user runs bundle install outside of the `ios/` folder, using the `--project-directory=ios` argument. ## Changelog: [iOS][Fixed] support bundle install from outside the ios folder using --project-directory Pull Request resolved: https://github.com/facebook/react-native/pull/46186 Test Plan: Ran the command in a project with `react-native-firebase/app` using the `--project-directory`, confirmed that it's fixed when using the absolute path. closes: reactwg/react-native-releases#341 Reviewed By: cipolleschi Differential Revision: D61719821 Pulled By: blakef fbshipit-source-id: d83429dd29c9e8cc066ab9843ad95fdfc0af8dea --- packages/react-native/scripts/cocoapods/autolinking.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-native/scripts/cocoapods/autolinking.rb b/packages/react-native/scripts/cocoapods/autolinking.rb index 0c56d8d4c5fa26..b2e5600bc5d386 100644 --- a/packages/react-native/scripts/cocoapods/autolinking.rb +++ b/packages/react-native/scripts/cocoapods/autolinking.rb @@ -73,6 +73,7 @@ def list_native_modules!(config_command) found_pods.push({ "configurations": configurations, "name": name, + "root": package["root"], "path": relative_path.to_path, "podspec_path": podspec_path, "script_phases": script_phases @@ -168,7 +169,7 @@ def link_native_modules!(config) # Support passing in a path relative to the root of the package if phase["path"] - phase["script"] = File.read(File.expand_path(phase["path"], package[:path])) + phase["script"] = File.read(File.expand_path(phase["path"], package[:root])) phase.delete("path") end