Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
<!-- prettier-ignore-end -->

## 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 ([#6911](https://github.com/getsentry/sentry-react-native/pull/6911))

## 8.31.0

### Features
Expand Down
4 changes: 3 additions & 1 deletion packages/core/plugin/src/withSentryIOS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
`;
Expand Down
19 changes: 19 additions & 0 deletions packages/core/test/expo-plugin/modifyXcodeProject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading