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

- Revert inputPaths to fix circular dependency build errors on iOS ([#5644](https://github.com/getsentry/sentry-react-native/pull/5644))

## 7.12.0

### Features
Expand Down
4 changes: 0 additions & 4 deletions packages/core/plugin/src/withSentryIOS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ export const withSentryIOS: ConfigPlugin<string> = (config, sentryProperties: st
xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
shellPath: '/bin/sh',
shellScript: `/bin/sh ${SENTRY_REACT_NATIVE_XCODE_DEBUG_FILES_PATH}`,
inputPaths: [
'"$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)/Contents/Resources/DWARF/$(PRODUCT_NAME)"',
'"$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)"',
],
});
}

Expand Down
98 changes: 0 additions & 98 deletions packages/core/test/expo-plugin/modifyXcodeProject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,101 +77,3 @@ describe('Configures iOS native project correctly', () => {
expect(warnOnce).toHaveBeenCalled();
});
});

describe('Upload Debug Symbols to Sentry build phase', () => {
let mockXcodeProject: any;
let addBuildPhaseSpy: jest.Mock;
const expectedShellScript =
"/bin/sh `${NODE_BINARY:-node} --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode-debug-files.sh'\"`";

const getOptions = () => {
const callArgs = addBuildPhaseSpy.mock.calls[0];
return callArgs[4];
};

beforeEach(() => {
addBuildPhaseSpy = jest.fn();
mockXcodeProject = {
pbxItemByComment: jest.fn().mockReturnValue(null),
addBuildPhase: addBuildPhaseSpy,
};
});

afterEach(() => {
jest.clearAllMocks();
});

it('creates Upload Debug Symbols build phase with correct shell script', () => {
mockXcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
shellPath: '/bin/sh',
shellScript: expectedShellScript,
});

expect(addBuildPhaseSpy).toHaveBeenCalledWith(
[],
'PBXShellScriptBuildPhase',
'Upload Debug Symbols to Sentry',
null,
{
shellPath: '/bin/sh',
shellScript: expectedShellScript,
},
);
});

it('does not include inputPaths in options before fix', () => {
mockXcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
shellPath: '/bin/sh',
shellScript: expectedShellScript,
});

const options = getOptions();

expect(options.inputPaths).toBeUndefined();
});

it('skips creating build phase if it already exists', () => {
mockXcodeProject.pbxItemByComment = jest.fn().mockReturnValue({
shellScript: 'existing',
});

expect(addBuildPhaseSpy).not.toHaveBeenCalled();
});

it('includes inputPaths with escaped quotes to avoid pbxproj serialization issues', () => {
mockXcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
shellPath: '/bin/sh',
shellScript: expectedShellScript,
inputPaths: [
'"$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)/Contents/Resources/DWARF/$(PRODUCT_NAME)"',
'"$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)"',
],
});

const options = getOptions();

expect(options.inputPaths).toBeDefined();
expect(options.inputPaths).toHaveLength(2);
});

it('inputPaths values are wrapped in escaped quotes', () => {
mockXcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
shellPath: '/bin/sh',
shellScript: expectedShellScript,
inputPaths: [
'"$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)/Contents/Resources/DWARF/$(PRODUCT_NAME)"',
'"$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)"',
],
});

const options = getOptions();

// Verify paths are wrapped in quotes to prevent pbxproj corruption
expect(options.inputPaths[0]).toMatch(/^".*"$/);
expect(options.inputPaths[1]).toMatch(/^".*"$/);
expect(options.inputPaths[0]).toBe(
'"$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)/Contents/Resources/DWARF/$(PRODUCT_NAME)"',
);
expect(options.inputPaths[1]).toBe('"$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)"');
});
});
Loading