From d108e99ce045ed5ca26d5f73cf5eae86753702ef Mon Sep 17 00:00:00 2001 From: Alexander Pantiukhov Date: Mon, 19 Oct 2026 11:16:57 +0200 Subject: [PATCH 1/2] fix(ios): Find .xcode.env in the debug symbols phase under SwiftPM --- CHANGELOG.md | 6 ++++++ packages/core/plugin/src/withSentryIOS.ts | 4 +++- .../expo-plugin/modifyXcodeProject.test.ts | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7498c3507..102cd01168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ > make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first. +## Unreleased + +### Fixes + +- Find `ios/.xcode.env` in the Expo plugin "Upload Debug Symbols to Sentry" phase when the iOS project uses Swift Package Manager instead of CocoaPods ([#XXXX](https://github.com/getsentry/sentry-react-native/pull/XXXX)) + ## 8.31.0 ### Features diff --git a/packages/core/plugin/src/withSentryIOS.ts b/packages/core/plugin/src/withSentryIOS.ts index 76b60f4466..62a9e1a1c0 100644 --- a/packages/core/plugin/src/withSentryIOS.ts +++ b/packages/core/plugin/src/withSentryIOS.ts @@ -16,7 +16,9 @@ const SENTRY_REACT_NATIVE_XCODE_DEBUG_FILES_PATH = "`\"${NODE_BINARY:-node}\" --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode-debug-files.sh'\"`"; const SENTRY_DISABLE_AUTO_UPLOAD_EXPORT = 'export SENTRY_DISABLE_AUTO_UPLOAD=true'; // Xcode started from the Dock has no node on PATH, so load NODE_BINARY the same way as with-environment.sh. -const LOAD_XCODE_ENV = `XCODE_ENV_PATH="\${PODFILE_DIR:-$PODS_ROOT/..}/.xcode.env" +// Swift Package Manager projects have no PODS_ROOT, so use SRCROOT as React Native's SPM build phases do. +const LOAD_XCODE_ENV = `XCODE_ENV_DIR="\${PODFILE_DIR:-\${PODS_ROOT:+$PODS_ROOT/..}}" +XCODE_ENV_PATH="\${XCODE_ENV_DIR:-$SRCROOT}/.xcode.env" [ -f "$XCODE_ENV_PATH" ] && . "$XCODE_ENV_PATH" [ -f "$XCODE_ENV_PATH.local" ] && . "$XCODE_ENV_PATH.local" `; diff --git a/packages/core/test/expo-plugin/modifyXcodeProject.test.ts b/packages/core/test/expo-plugin/modifyXcodeProject.test.ts index d5ac327773..0edc5da100 100644 --- a/packages/core/test/expo-plugin/modifyXcodeProject.test.ts +++ b/packages/core/test/expo-plugin/modifyXcodeProject.test.ts @@ -629,6 +629,25 @@ describe('Upload Debug Symbols phase loads .xcode.env before it resolves the scr expect(stdout).toContain('debug files script ran'); }); + it('uses SRCROOT to find .xcode.env when the project has no CocoaPods', () => { + fs.writeFileSync(path.join(iosDir, '.xcode.env.local'), `export NODE_BINARY="${process.execPath}"\n`); + + const stdout = runPhase(getDebugFilesUploadScript(), { SRCROOT: iosDir }); + + expect(stdout).toContain('debug files script ran'); + }); + + it('uses PODS_ROOT before SRCROOT to find .xcode.env', () => { + fs.writeFileSync(path.join(iosDir, '.xcode.env.local'), `export NODE_BINARY="${process.execPath}"\n`); + + const stdout = runPhase(getDebugFilesUploadScript(), { + PODS_ROOT: path.join(iosDir, 'Pods'), + SRCROOT: '/nonexistent', + }); + + expect(stdout).toContain('debug files script ran'); + }); + it('uses a NODE_BINARY path that contains spaces', () => { const nodeDir = path.join(projectDir, 'dir with spaces'); fs.mkdirSync(nodeDir); From 68384cdc70feb845388ca620dbbb996524bf45da Mon Sep 17 00:00:00 2001 From: Alexander Pantiukhov Date: Mon, 19 Oct 2026 11:22:31 +0200 Subject: [PATCH 2/2] Update CHANGELOG PR number --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 102cd01168..f5dbb6ecae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ### Fixes -- Find `ios/.xcode.env` in the Expo plugin "Upload Debug Symbols to Sentry" phase when the iOS project uses Swift Package Manager instead of CocoaPods ([#XXXX](https://github.com/getsentry/sentry-react-native/pull/XXXX)) +- Find `ios/.xcode.env` in the Expo plugin "Upload Debug Symbols to Sentry" phase when the iOS project uses Swift Package Manager instead of CocoaPods ([#6911](https://github.com/getsentry/sentry-react-native/pull/6911)) ## 8.31.0