Skip to content
Merged
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"
}
}

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
7 changes: 3 additions & 4 deletions sentry-samples/sentry-samples-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ android {
// Suffix the id so debug and release builds can be installed side by side.
applicationIdSuffix = ".debug"
addManifestPlaceholders(mapOf("sentryDebug" to true, "sentryEnvironment" to "debug"))
// The SDK modules only publish a release variant, so fall back to it for the
// debug build of the sample.
matchingFallbacks += "release"
Comment thread
runningcode marked this conversation as resolved.
}
getByName("release") {
isMinifyEnabled = true
Expand All @@ -133,10 +136,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