Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add flag to disable debug file upload #4223

Merged
merged 6 commits into from
Nov 4, 2024
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
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@

## Unreleased

### Features

- Add env flag `SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD` to allow disabling the debug file upload ([#4223](https://github.com/getsentry/sentry-react-native/pull/4223))

How to use in Android project? It works by default, just set `export SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD=true` in your build environment. For Sentry Android Gradle Plugin add the following to your `android/app/build.gradle`.

```gradle
apply from: "../../../sentry.gradle"

sentry {
autoUploadProguardMapping = shouldSentryAutoUpload()
uploadNativeSymbols = shouldSentryAutoUpload()
}
```

How to use in Xcode? Make sure you are using `scripts/sentry-xcode.sh` and `scripts/sentry-xcode-debug-files.sh` in your
build phases. And add the following to your `ios/.xcode.env.local` file.

```bash
export SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD=true
```

### Fixes

- Skips ignoring require cycle logs for RN 0.70 or newer ([#4214](https://github.com/getsentry/sentry-react-native/pull/4214))
Expand Down
2 changes: 2 additions & 0 deletions packages/core/scripts/sentry-xcode-debug-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ XCODE_BUILD_CONFIGURATION="${CONFIGURATION}"

if [ "$SENTRY_DISABLE_AUTO_UPLOAD" == true ]; then
echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping debug files upload"
elif [ "$SENTRY_DISABLE_XCODE_DEBUG_UPLOAD" == true ]; then
echo "SENTRY_DISABLE_XCODE_DEBUG_UPLOAD=true, skipping native debug files upload"
elif echo "$XCODE_BUILD_CONFIGURATION" | grep -iq "debug"; then # case insensitive check for "debug"
echo "Skipping debug files upload for *Debug* configuration"
else
Expand Down
3 changes: 2 additions & 1 deletion packages/core/sentry.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import java.util.regex.Matcher
import java.util.regex.Pattern

project.ext.shouldSentryAutoUpload = { ->
return System.getenv('SENTRY_DISABLE_AUTO_UPLOAD') != 'true'
return System.getenv('SENTRY_DISABLE_AUTO_UPLOAD') != 'true' ||
System.getenv('SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD') != 'true'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @lucas-zimerman 👋
While checking some a CI checks issue on a dependandabot PR I revisited the Android logic here. I think for the new flag to work as on iOS we should change || with &&. Wdyt?

project.ext.shouldSentryAutoUpload = { ->
  return System.getenv('SENTRY_DISABLE_AUTO_UPLOAD') != 'true' &&
         System.getenv('SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD') != 'true'
}

or

project.ext.shouldSentryAutoUpload = { ->
  return !(System.getenv('SENTRY_DISABLE_AUTO_UPLOAD') == 'true' ||
         System.getenv('SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD') == 'true')
}

}

def config = project.hasProperty("sentryCli") ? project.sentryCli : [];
Expand Down
Loading