Skip to content

Commit 47e6045

Browse files
author
Lalit Sharma
committed
feat: enhance Sentry configuration handling in build.gradle for better error reporting
1 parent 236ab43 commit 47e6045

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

apps/mobile/android/app/build.gradle

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,20 @@ def enableMinifyInReleaseBuilds = (findProperty('android.enableMinifyInReleaseBu
8181
*/
8282
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
8383

84-
apply from: new File(["node", "--print", "require('path').dirname(require.resolve('@sentry/react-native/package.json'))"].execute().text.trim(), "sentry.gradle")
84+
def sentryOrg = (System.getenv("SENTRY_ORG") ?: "").trim()
85+
def sentryProject = (System.getenv("SENTRY_PROJECT") ?: "").trim()
86+
def sentryAuthToken = (System.getenv("SENTRY_AUTH_TOKEN") ?: "").trim()
87+
def sentryConfigured = sentryOrg.length() > 0 &&
88+
sentryProject.length() > 0 &&
89+
sentryAuthToken.length() > 0 &&
90+
!sentryOrg.startsWith("__YOUR_") &&
91+
!sentryProject.startsWith("__YOUR_")
92+
93+
if (sentryConfigured) {
94+
apply from: new File(["node", "--print", "require('path').dirname(require.resolve('@sentry/react-native/package.json'))"].execute().text.trim(), "sentry.gradle")
95+
} else {
96+
println("[sentry] Source map upload disabled: set SENTRY_ORG, SENTRY_PROJECT, and SENTRY_AUTH_TOKEN to enable it.")
97+
}
8598

8699
android {
87100
ndkVersion rootProject.ext.ndkVersion

0 commit comments

Comments
 (0)