From 27600427a9515548d35c490ba202d5498371f284 Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Date: Fri, 9 Jun 2023 09:06:37 -0700 Subject: [PATCH] Fix loading NODE_BINARY inside Generate Legacy Components Interop (#37802) Summary: When trying to build an app using 0.72.0-RC.5 inside a project that uses `.xcode.env.local` the `[CP-User] Generate Legacy Components Interop` Phase script fails to run due to a `Permission denied` error. That's because `.xcode.env.local` is not being loaded, resulting in `NODE_BINARY=" "` and then the `React-RCTAppDelegate` script tries to run `generate-legacy-interop-components.js` directly. E.g ![image](https://github.com/facebook/react-native/assets/11707729/ce72d7d1-69ab-4477-a754-10cd52bb21a2) In order to fix this we should run the `with-environment.sh` script instead of directly loading `.${PODS_ROOT}/../.xcode.env` ## Changelog: [IOS] [FIXED] - Fix loading `NODE_BINARY` inside Generate Legacy Components Interop Pull Request resolved: https://github.com/facebook/react-native/pull/37802 Test Plan: Make sure you don't have a `.xcode.env` file and run locally a project that uses React-RCTAppDelegate Reviewed By: cortinico Differential Revision: D46596246 Pulled By: cipolleschi fbshipit-source-id: 5616395f39b0fae7b2fa9e59bd72c70f39198b4d --- .../Libraries/AppDelegate/React-RCTAppDelegate.podspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec b/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec index 1fa8fc0e2ddc8a..1c1ae9b5a4a9d7 100644 --- a/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec +++ b/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec @@ -99,7 +99,8 @@ Pod::Spec.new do |s| s.script_phases = { :name => "Generate Legacy Components Interop", :script => " -. ${PODS_ROOT}/../.xcode.env +WITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\" +source $WITH_ENVIRONMENT ${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p #{ENV['APP_PATH']} -o ${REACT_NATIVE_PATH}/Libraries/AppDelegate ", :execution_position => :before_compile,