From 4ee2b60a1eacca744d58a7ad336ca9d3714289f6 Mon Sep 17 00:00:00 2001 From: Christian Falch Date: Thu, 17 Jul 2025 06:46:00 -0700 Subject: [PATCH] resolve xcframework paths from conf switch script (#52664) Summary: When switching between debug/release we run a small script to make sure to copy the correct version of the RNDeps xcframework. This script was missing a resolve function that fixed up some path issues that we do when installing in the podspec. ## Changelog: [IOS] [FIXED] - Fixed issue with RNDeps release/debug switch failing Pull Request resolved: https://github.com/facebook/react-native/pull/52664 Test Plan: - Create new RN App - Install pod with prebuilt deps - Build (success) - Switch to release - Build (success) Reviewed By: cortinico Differential Revision: D78481590 Pulled By: cipolleschi fbshipit-source-id: 2d02b0bc55e8aef6f3fafb4f7aa193c4cf00414e --- .../replace_dependencies_version.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/react-native/third-party-podspecs/replace_dependencies_version.js b/packages/react-native/third-party-podspecs/replace_dependencies_version.js index ac3f24a7b57..56d0b9f2706 100644 --- a/packages/react-native/third-party-podspecs/replace_dependencies_version.js +++ b/packages/react-native/third-party-podspecs/replace_dependencies_version.js @@ -67,6 +67,25 @@ function replaceRNDepsConfiguration( console.log('Extracting the tarball', tarballURLPath); execSync(`tar -xf ${tarballURLPath} -C ${finalLocation}`); + + // Now we need to remove the extra third-party folder as we do in the podspec's prepare-script + // We need to take the ReactNativeDependencies.xcframework folder and move it up one level + // from ${finalLocation}/packages/react-native/third-party/ to ${finalLocation}/packages/react-native/ + console.log('Resolving ReactNativeDependencies.xcframework folder structure'); + const thirdPartyPath = `${finalLocation}/packages/react-native/third-party`; + const sourcePath = `${thirdPartyPath}/ReactNativeDependencies.xcframework`; + const destinationPath = `${finalLocation}/packages/react-native/ReactNativeDependencies.xcframework`; + if (fs.existsSync(sourcePath)) { + fs.renameSync(sourcePath, destinationPath); + } else { + throw new Error( + `Expected ReactNativeDependencies.xcframework to be at ${sourcePath}, but it was not found.`, + ); + } + + if (fs.existsSync(thirdPartyPath)) { + fs.rmSync(thirdPartyPath, {force: true, recursive: true}); + } } function updateLastBuildConfiguration(configuration /*: string */) {