diff --git a/CHANGELOG.md b/CHANGELOG.md index c6220b7097..55e567c1a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ > make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first. +## Unreleased + +### Fixes + +- Fix Android Gradle source map upload being silently skipped on some occasions ([#6320](https://github.com/getsentry/sentry-react-native/pull/6320)) + ## 8.15.0 ### Features diff --git a/packages/core/sentry.gradle.kts b/packages/core/sentry.gradle.kts index 4d8762ccd6..69ee83ca72 100644 --- a/packages/core/sentry.gradle.kts +++ b/packages/core/sentry.gradle.kts @@ -253,19 +253,25 @@ fun extractBundleTaskArguments( val jsSourceMapsDir = (props["jsSourceMapsDir"] as? org.gradle.api.provider.Provider<*>)?.orNull val jsIntermediateSourceMapsDir = (props["jsIntermediateSourceMapsDir"] as? org.gradle.api.provider.Provider<*>)?.orNull + // React Native's BundleHermesCTask declares `jsIntermediateSourceMapsDir` as a `RegularFileProperty` + // (and other versions may do the same for the bundle/sourcemap dirs) even though they hold a + // directory path, so accept both `Directory` and `RegularFile` here. val bundleDirFile = when (jsBundleDir) { is org.gradle.api.file.Directory -> jsBundleDir.asFile + is org.gradle.api.file.RegularFile -> jsBundleDir.asFile else -> return BundleTaskArgs(null, null, null, null) } val sourcemapsDirFile = when (jsSourceMapsDir) { is org.gradle.api.file.Directory -> jsSourceMapsDir.asFile + is org.gradle.api.file.RegularFile -> jsSourceMapsDir.asFile else -> return BundleTaskArgs(null, null, null, null) } val intermediateSourcemapsDirFile = when (jsIntermediateSourceMapsDir) { is org.gradle.api.file.Directory -> jsIntermediateSourceMapsDir.asFile + is org.gradle.api.file.RegularFile -> jsIntermediateSourceMapsDir.asFile else -> return BundleTaskArgs(null, null, null, null) }