Skip to content

Commit 02e6bc8

Browse files
runningcodeclaude
andauthored
build: Disable Android debug variants outside the sample app (#5825)
Unit tests already target the release variant (testBuildType = release) and CI disabled the debug variant. Disable the debug variant locally too so local builds match CI and skip building the unused variant. The sample app keeps both variants for manual runs and profiling. Update the contributor docs and test skill to reference testReleaseUnitTest instead of testDebugUnitTest. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 01572ad commit 02e6bc8

15 files changed

Lines changed: 33 additions & 32 deletions

File tree

.claude/skills/test/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ Determine the Gradle test task:
4040

4141
| Module Pattern | Test Task |
4242
|---------------|-----------|
43-
| `sentry-android-*` | `testDebugUnitTest` |
44-
| `sentry-compose*` | `testDebugUnitTest` |
45-
| `*-android` | `testDebugUnitTest` |
43+
| `sentry-android-*` | `testReleaseUnitTest` |
44+
| `sentry-compose*` | `testReleaseUnitTest` |
45+
| `*-android` | `testReleaseUnitTest` |
4646
| Everything else | `test` |
4747

4848
**Interactive mode:** Before running, read the test class file and use AskUserQuestion to ask:

.cursor/rules/coding.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ sentry-java is the Java and Android SDK for Sentry. This repository contains the
2424
./gradlew check
2525

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

3030
## Contributing Guidelines

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ The project uses **Gradle** with Kotlin DSL. Key build files:
4444
### Testing
4545
```bash
4646
# Run unit tests for a specific file
47-
./gradlew ':<module>:testDebugUnitTest' --tests="*<file name>*" --info
47+
./gradlew ':<module>:testReleaseUnitTest' --tests="*<file name>*" --info
4848

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

5252
# Run specific test suites
53-
./gradlew :sentry-android-core:testDebugUnitTest
53+
./gradlew :sentry-android-core:testReleaseUnitTest
5454
./gradlew :sentry:test
5555
```
5656

buildSrc/src/main/java/Config.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ object Config {
1212
object Android {
1313
val abiFilters = listOf("x86", "armeabi-v7a", "x86_64", "arm64-v8a")
1414

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

sentry-android-core/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ android {
3434
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
3535
}
3636

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

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

8989
dependencies {

sentry-android-distribution/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ android {
1313
defaultConfig { minSdk = libs.versions.minSdk.get().toInt() }
1414
buildFeatures { buildConfig = false }
1515

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

2020
testOptions {

sentry-android-fragment/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ android {
2525
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
2626
}
2727

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

3232
kotlin {

sentry-android-navigation/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ android {
2525
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
2626
}
2727

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

3232
kotlin {

sentry-android-ndk/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ android {
2626
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
2727
}
2828

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

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

sentry-android-replay/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ android {
3434
getByName("release") { consumerProguardFiles("proguard-rules.pro") }
3535
}
3636

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

4141
kotlin {

0 commit comments

Comments
 (0)