From 05fce7ce12a35632cb69a557a71ad22a377a00a4 Mon Sep 17 00:00:00 2001 From: imWildCat Date: Thu, 27 Jun 2024 09:17:10 -0600 Subject: [PATCH 1/4] resolve absolute path of the script phase --- packages/react-native/scripts/cocoapods/autolinking.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-native/scripts/cocoapods/autolinking.rb b/packages/react-native/scripts/cocoapods/autolinking.rb index fec826c541ee17..57a8f77ab6b9dc 100644 --- a/packages/react-native/scripts/cocoapods/autolinking.rb +++ b/packages/react-native/scripts/cocoapods/autolinking.rb @@ -47,7 +47,11 @@ def list_native_modules!(config_command) name = package["name"] podspec_path = package_config["podspecPath"] - script_phases = package_config["scriptPhases"] + script_phases = package_config["scriptPhases"].map do |script_phase| + script_phase.merge({ + "path" => File.join(File.dirname(podspec_path), script_phase["path"]), + }) + end configurations = package_config["configurations"] # Add a warning to the queue and continue to the next dependency if the podspec_path is nil/empty From fc759b51ef3e38dd1cd2294d602a3eb1fa1d75b2 Mon Sep 17 00:00:00 2001 From: imWildCat Date: Thu, 27 Jun 2024 11:02:37 -0600 Subject: [PATCH 2/4] Revert "resolve absolute path of the script phase" This reverts commit 05fce7ce12a35632cb69a557a71ad22a377a00a4. --- packages/react-native/scripts/cocoapods/autolinking.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/react-native/scripts/cocoapods/autolinking.rb b/packages/react-native/scripts/cocoapods/autolinking.rb index 57a8f77ab6b9dc..fec826c541ee17 100644 --- a/packages/react-native/scripts/cocoapods/autolinking.rb +++ b/packages/react-native/scripts/cocoapods/autolinking.rb @@ -47,11 +47,7 @@ def list_native_modules!(config_command) name = package["name"] podspec_path = package_config["podspecPath"] - script_phases = package_config["scriptPhases"].map do |script_phase| - script_phase.merge({ - "path" => File.join(File.dirname(podspec_path), script_phase["path"]), - }) - end + script_phases = package_config["scriptPhases"] configurations = package_config["configurations"] # Add a warning to the queue and continue to the next dependency if the podspec_path is nil/empty From 4a1838b258cae156cc16ab08a825f97821df1e4e Mon Sep 17 00:00:00 2001 From: imWildCat Date: Thu, 27 Jun 2024 11:03:27 -0600 Subject: [PATCH 3/4] update the fix thanks to @blakef 's suggestion --- packages/react-native/scripts/cocoapods/autolinking.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/scripts/cocoapods/autolinking.rb b/packages/react-native/scripts/cocoapods/autolinking.rb index fec826c541ee17..9508625fc4c434 100644 --- a/packages/react-native/scripts/cocoapods/autolinking.rb +++ b/packages/react-native/scripts/cocoapods/autolinking.rb @@ -168,7 +168,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["root"])) + phase["script"] = File.read(File.expand_path(phase["path"], package[:root])) phase.delete("path") end From 99adf9dfea359d69340553628265b16714789885 Mon Sep 17 00:00:00 2001 From: imWildCat Date: Thu, 27 Jun 2024 11:21:42 -0600 Subject: [PATCH 4/4] fix the script per @cipolleschi 's comment --- packages/react-native/scripts/cocoapods/autolinking.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/scripts/cocoapods/autolinking.rb b/packages/react-native/scripts/cocoapods/autolinking.rb index 9508625fc4c434..0c56d8d4c5fa26 100644 --- a/packages/react-native/scripts/cocoapods/autolinking.rb +++ b/packages/react-native/scripts/cocoapods/autolinking.rb @@ -168,7 +168,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[:root])) + phase["script"] = File.read(File.expand_path(phase["path"], package[:path])) phase.delete("path") end