Skip to content
Draft
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
4 changes: 2 additions & 2 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ high_risk_code: &high_risk_code
# Source Maps and Native Debug Files Autoupload
- 'scripts/sentry-xcode.sh'
- 'scripts/sentry-xcode-debug-files.sh'
- 'sentry.gradle'
- 'sentry.gradle.kts'

# --- Platform-specific filters for CI optimization ---
# Used by detect-changes.yml to skip platform-irrelevant CI jobs.
Expand All @@ -32,7 +32,7 @@ ios_native:
android_native:
- 'packages/core/android/**'
- 'packages/core/RNSentryAndroidTester/**'
- 'packages/core/sentry.gradle'
- 'packages/core/sentry.gradle.kts'

# Changes to JS/TS source code (affects ALL platforms)
js_source:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (!args['app-build-gradle']) {
debug.log('Patching app/build.gradle', args['app-build-gradle']);

const sentryGradlePatch = `
apply from: new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute().text.trim(), "../sentry.gradle")
apply from: new File(["node", "--print", "require.resolve('@sentry/react-native/package.json')"].execute().text.trim(), "../sentry.gradle.kts")
`;
const reactNativeGradleRex = /^android {/m;

Expand Down
9 changes: 7 additions & 2 deletions packages/core/plugin/src/withSentryAndroid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ const resolveSentryReactNativePackageJsonPath =
* adding the relevant @sentry/react-native script.
*/
export function modifyAppBuildGradle(buildGradle: string): string {
if (buildGradle.includes('sentry.gradle')) {
if (buildGradle.includes('sentry.gradle.kts')) {
return buildGradle;
}

// Migrate old sentry.gradle references to sentry.gradle.kts
if (buildGradle.includes('sentry.gradle')) {
return buildGradle.replace(/sentry\.gradle(?!\.kts)/g, 'sentry.gradle.kts');
}

// Use the same location that sentry-wizard uses
// See: https://github.com/getsentry/sentry-wizard/blob/e9b4522f27a852069c862bd458bdf9b07cab6e33/lib/Steps/Integrations/ReactNative.ts#L232
const pattern = /^android {/m;
Expand All @@ -55,7 +60,7 @@ export function modifyAppBuildGradle(buildGradle: string): string {
return buildGradle;
}

const applyFrom = `apply from: new File(${resolveSentryReactNativePackageJsonPath}, "sentry.gradle")`;
const applyFrom = `apply from: new File(${resolveSentryReactNativePackageJsonPath}, "sentry.gradle.kts")`;

return buildGradle.replace(pattern, match => `${applyFrom}\n\n${match}`);
}
Expand Down
589 changes: 1 addition & 588 deletions packages/core/sentry.gradle

Large diffs are not rendered by default.

Loading
Loading