From 585c8ca23155a446a663d52a3937161133c6dd43 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Thu, 22 Feb 2024 10:53:42 +0100 Subject: [PATCH 1/2] feat(expo): Add concrete error messages for RN bundle build phase patch --- CHANGELOG.md | 4 ++++ plugin/src/withSentryIOS.ts | 27 +++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7776c52fa..2a22d9aa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Features + +- Add concrete error messages for RN bundle build phase patch ([#3622](https://github.com/getsentry/sentry-react-native/pull/3622)) + ### Fixes - Option `enabled: false` ensures no events are sent ([#3606](https://github.com/getsentry/sentry-react-native/pull/3606)) diff --git a/plugin/src/withSentryIOS.ts b/plugin/src/withSentryIOS.ts index 60460fc51..c33cd8d6b 100644 --- a/plugin/src/withSentryIOS.ts +++ b/plugin/src/withSentryIOS.ts @@ -46,14 +46,29 @@ export const withSentryIOS: ConfigPlugin = (config, sentryProperties: st }; export function modifyExistingXcodeBuildScript(script: BuildPhase): void { - if ( - !script.shellScript.match(/(packager|scripts)\/react-native-xcode\.sh\b/) || - script.shellScript.includes('sentry-xcode.sh') || - script.shellScript.includes('@sentry') - ) { + if (!script.shellScript.match(/(packager|scripts)\/react-native-xcode\.sh\b/)) { WarningAggregator.addWarningIOS( SDK_PACKAGE_NAME, - "Unable to modify build script 'Bundle React Native code and images'. Please open a bug report at https://github.com/expo/sentry-expo.", + `'react-native-xcode.sh' not found in 'Bundle React Native code and images'. +Please open a bug report at https://github.com/getsentry/sentry-react-native`, + ); + return; + } + + if (script.shellScript.includes('sentry-xcode.sh')) { + WarningAggregator.addWarningIOS( + SDK_PACKAGE_NAME, + "The latest 'sentry-xcode.sh' script already exists in 'Bundle React Native code and images'.", + ); + return; + } + + if (script.shellScript.includes('@sentry')) { + WarningAggregator.addWarningIOS( + SDK_PACKAGE_NAME, + `Outdated or custom Sentry script found in 'Bundle React Native code and images'. +Regenerate the native project to use the latest script. +Run npx expo prebuild --clean`, ); return; } From 4faf66757eff3c955e6a8f8e8fc6f500ce4cf54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kry=C5=A1tof=20Wold=C5=99ich?= <31292499+krystofwoldrich@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:31:25 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a22d9aa4..a9d0b312f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Features -- Add concrete error messages for RN bundle build phase patch ([#3622](https://github.com/getsentry/sentry-react-native/pull/3622)) +- Add concrete error messages for RN bundle build phase patch ([#3626](https://github.com/getsentry/sentry-react-native/pull/3626)) ### Fixes