diff --git a/CHANGELOG.md b/CHANGELOG.md index 675ae3447..23e33245e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ - Add more expressive debug logs to Native Frames Integration ([#3880](https://github.com/getsentry/sentry-react-native/pull/3880)) - Add missing tracing integrations when using `client.init()` ([#3882](https://github.com/getsentry/sentry-react-native/pull/3882)) +- Ensure `sentry-cli` doesn't trigger Xcode `error:` prefix ([#3887](https://github.com/getsentry/sentry-react-native/pull/3887)) + - Fixes `--allow-failure` failing Xcode builds ### Dependencies diff --git a/scripts/sentry-xcode-debug-files.sh b/scripts/sentry-xcode-debug-files.sh index 8fcc403fb..236a4df7d 100755 --- a/scripts/sentry-xcode-debug-files.sh +++ b/scripts/sentry-xcode-debug-files.sh @@ -35,5 +35,14 @@ if [ "$SENTRY_DISABLE_AUTO_UPLOAD" == true ]; then elif echo "$XCODE_BUILD_CONFIGURATION" | grep -iq "debug"; then # case insensitive check for "debug" echo "Skipping debug files upload for *Debug* configuration" else - /bin/sh -c "\"$LOCAL_NODE_BINARY\" $UPLOAD_DEBUG_FILES" + # 'warning:' triggers a warning in Xcode, 'error:' triggers an error + set +x +e # disable printing commands otherwise we might print `error:` by accident and allow continuing on error + SENTRY_UPLOAD_COMMAND_OUTPUT=$(/bin/sh -c "\"$LOCAL_NODE_BINARY\" $UPLOAD_DEBUG_FILES" 2>&1) + if [ $? -eq 0 ]; then + echo "$SENTRY_UPLOAD_COMMAND_OUTPUT" | awk '{print "output: sentry-cli - " $0}' + else + echo "error: sentry-cli - To disable native debug files auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true" + echo "error: sentry-cli - $SENTRY_UPLOAD_COMMAND_OUTPUT" + fi + set -x -e # re-enable fi diff --git a/scripts/sentry-xcode.sh b/scripts/sentry-xcode.sh index 3752345c3..e36fa74e0 100755 --- a/scripts/sentry-xcode.sh +++ b/scripts/sentry-xcode.sh @@ -23,7 +23,16 @@ ARGS="$NO_AUTO_RELEASE $SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_RN_XCODE_EXTRA_ARGS" REACT_NATIVE_XCODE_WITH_SENTRY="\"$SENTRY_CLI_EXECUTABLE\" react-native xcode $ARGS \"$REACT_NATIVE_XCODE\"" if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then - /bin/sh -c "\"$LOCAL_NODE_BINARY\" $REACT_NATIVE_XCODE_WITH_SENTRY" + # 'warning:' triggers a warning in Xcode, 'error:' triggers an error + set +x +e # disable printing commands otherwise we might print `error:` by accident and allow continuing on error + SENTRY_XCODE_COMMAND_OUTPUT=$(/bin/sh -c "\"$LOCAL_NODE_BINARY\" $REACT_NATIVE_XCODE_WITH_SENTRY" 2>&1) + if [ $? -eq 0 ]; then + echo "$SENTRY_XCODE_COMMAND_OUTPUT" | awk '{print "output: sentry-cli - " $0}' + else + echo "error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true" + echo "error: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT" + fi + set -x -e # re-enable else echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping sourcemaps upload" /bin/sh -c "$REACT_NATIVE_XCODE"