Skip to content
Closed
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
6 changes: 3 additions & 3 deletions .claude/skills/test/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Determine the Gradle test task:

| Module Pattern | Test Task |
|---------------|-----------|
| `sentry-android-*` | `testDebugUnitTest` |
| `sentry-compose*` | `testDebugUnitTest` |
| `*-android` | `testDebugUnitTest` |
| `sentry-android-*` | `testReleaseUnitTest` |
| `sentry-compose*` | `testReleaseUnitTest` |
| `*-android` | `testReleaseUnitTest` |
| Everything else | `test` |

**Interactive mode:** Before running, read the test class file and use AskUserQuestion to ask:
Expand Down
2 changes: 1 addition & 1 deletion .cursor/rules/coding.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sentry-java is the Java and Android SDK for Sentry. This repository contains the
./gradlew check

# Run unit tests for a specific file
./gradlew ':<module>:testDebugUnitTest' --tests="*<file name>*" --info
./gradlew ':<module>:testReleaseUnitTest' --tests="*<file name>*" --info
```

## Contributing Guidelines
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ The project uses **Gradle** with Kotlin DSL. Key build files:
### Testing
```bash
# Run unit tests for a specific file
./gradlew ':<module>:testDebugUnitTest' --tests="*<file name>*" --info
./gradlew ':<module>:testReleaseUnitTest' --tests="*<file name>*" --info

# Run system tests (requires Python virtual env)
make systemTest

# Run specific test suites
./gradlew :sentry-android-core:testDebugUnitTest
./gradlew :sentry-android-core:testReleaseUnitTest
./gradlew :sentry:test
```

Expand Down
4 changes: 3 additions & 1 deletion buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ object Config {
object Android {
val abiFilters = listOf("x86", "armeabi-v7a", "x86_64", "arm64-v8a")

// Debug variants are disabled everywhere. Unit tests run against the release
// variant, so building the debug variant would only add overhead.
fun shouldSkipDebugVariant(name: String?): Boolean {
return System.getenv("CI")?.toBoolean() ?: false && name == "debug"
return name == "debug"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sample debug variant resolution broken

High Severity

shouldSkipDebugVariant now always disables library debug variants, while sentry-samples-android still builds debug and depends on those projects (including via debugImplementation). The sample debug build type has no matchingFallbacks to release, so installDebug/assembleDebug can fail variant-aware dependency resolution.

Additional Locations (2)
Fix in Cursorย Fix in Web

Reviewed by Cursor Bugbot for commit 50cdc0a. Configure here.

}
}

Expand Down
6 changes: 3 additions & 3 deletions sentry-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

kotlin { compilerOptions.jvmTarget = JVM_1_8 }
Expand Down Expand Up @@ -83,7 +83,7 @@ tasks.withType<JavaCompile>().configureEach {
// outputs so Gradle's build cache restores them on cache hits (otherwise the CLI upload step
// finds an empty directory).
tasks
.matching { it.name == "testDebugUnitTest" || it.name == "testReleaseUnitTest" }
.matching { it.name == "testReleaseUnitTest" }
.configureEach { outputs.dir(layout.buildDirectory.dir("test-snapshots")) }

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-distribution/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
defaultConfig { minSdk = libs.versions.minSdk.get().toInt() }
buildFeatures { buildConfig = false }

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

testOptions {
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-fragment/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

kotlin {
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-navigation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

kotlin {
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-ndk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 }
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-replay/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

kotlin {
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-sqlite/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

kotlin {
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-timber/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

kotlin {
Expand Down
4 changes: 2 additions & 2 deletions sentry-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

testOptions {
Expand Down
4 changes: 2 additions & 2 deletions sentry-launchdarkly-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ android {
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
}

// AGP 9 only generates unit tests for the testBuildType. CI disables the debug
// variant, so unit tests must target release to run at all.
// AGP 9 only generates unit tests for the testBuildType. The debug variant is
// disabled, so unit tests must target release to run at all.
testBuildType = "release"

kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8 }
Expand Down
4 changes: 0 additions & 4 deletions sentry-samples/sentry-samples-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ android {

kotlin { compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 }

androidComponents.beforeVariants {
it.enable = !Config.Android.shouldSkipDebugVariant(it.buildType)
}

androidComponents.onVariants { variant ->
variant.buildConfigFields?.put(
"USE_SAGP",
Expand Down
Loading