Skip to content

Commit 785b737

Browse files
fix(xcode): Xcode command line builds fail with --allow-failure (#3887)
1 parent 9fc8151 commit 785b737

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
- Add more expressive debug logs to Native Frames Integration ([#3880](https://github.com/getsentry/sentry-react-native/pull/3880))
1414
- Add missing tracing integrations when using `client.init()` ([#3882](https://github.com/getsentry/sentry-react-native/pull/3882))
15+
- Ensure `sentry-cli` doesn't trigger Xcode `error:` prefix ([#3887](https://github.com/getsentry/sentry-react-native/pull/3887))
16+
- Fixes `--allow-failure` failing Xcode builds
1517

1618
### Dependencies
1719

scripts/sentry-xcode-debug-files.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,14 @@ if [ "$SENTRY_DISABLE_AUTO_UPLOAD" == true ]; then
3535
elif echo "$XCODE_BUILD_CONFIGURATION" | grep -iq "debug"; then # case insensitive check for "debug"
3636
echo "Skipping debug files upload for *Debug* configuration"
3737
else
38-
/bin/sh -c "\"$LOCAL_NODE_BINARY\" $UPLOAD_DEBUG_FILES"
38+
# 'warning:' triggers a warning in Xcode, 'error:' triggers an error
39+
set +x +e # disable printing commands otherwise we might print `error:` by accident and allow continuing on error
40+
SENTRY_UPLOAD_COMMAND_OUTPUT=$(/bin/sh -c "\"$LOCAL_NODE_BINARY\" $UPLOAD_DEBUG_FILES" 2>&1)
41+
if [ $? -eq 0 ]; then
42+
echo "$SENTRY_UPLOAD_COMMAND_OUTPUT" | awk '{print "output: sentry-cli - " $0}'
43+
else
44+
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"
45+
echo "error: sentry-cli - $SENTRY_UPLOAD_COMMAND_OUTPUT"
46+
fi
47+
set -x -e # re-enable
3948
fi

scripts/sentry-xcode.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@ ARGS="$NO_AUTO_RELEASE $SENTRY_CLI_EXTRA_ARGS $SENTRY_CLI_RN_XCODE_EXTRA_ARGS"
2323
REACT_NATIVE_XCODE_WITH_SENTRY="\"$SENTRY_CLI_EXECUTABLE\" react-native xcode $ARGS \"$REACT_NATIVE_XCODE\""
2424

2525
if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
26-
/bin/sh -c "\"$LOCAL_NODE_BINARY\" $REACT_NATIVE_XCODE_WITH_SENTRY"
26+
# 'warning:' triggers a warning in Xcode, 'error:' triggers an error
27+
set +x +e # disable printing commands otherwise we might print `error:` by accident and allow continuing on error
28+
SENTRY_XCODE_COMMAND_OUTPUT=$(/bin/sh -c "\"$LOCAL_NODE_BINARY\" $REACT_NATIVE_XCODE_WITH_SENTRY" 2>&1)
29+
if [ $? -eq 0 ]; then
30+
echo "$SENTRY_XCODE_COMMAND_OUTPUT" | awk '{print "output: sentry-cli - " $0}'
31+
else
32+
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"
33+
echo "error: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT"
34+
fi
35+
set -x -e # re-enable
2736
else
2837
echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping sourcemaps upload"
2938
/bin/sh -c "$REACT_NATIVE_XCODE"

0 commit comments

Comments
 (0)