Skip to content

Commit 76332ce

Browse files
runningcodeclaude
andcommitted
build(samples): Move the Android integration tests to their own build
sentry-uitest-android, sentry-uitest-android-critical and test-app-size are now a standalone Gradle build that includes the SDK build, like the Android sample. They depend on io.sentry:* coordinates, which Gradle substitutes with the SDK's projects, including the unpublished sentry-test-support. The SDK build doesn't include them back, so SAGP, errorprone's uitest checks and their AndroidX test dependencies no longer load in the SDK build. AGP stays shared: a composite build can only use one AGP version, so the AGP matrix job's VERSION_AGP still applies to both builds. Root check and spotlessApply no longer reach these apps, so preMerge runs this build's check, which covers what the root check ran for them: lint, detekt and spotless. The format workflow runs its spotlessApply, and the AGP matrix, UI test and size workflows call it with -p. APK paths don't change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e4a9b5a commit 76332ce

15 files changed

Lines changed: 162 additions & 29 deletions

File tree

‎.github/workflows/agp-matrix.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
disable-spellchecker: true
9191
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
9292
disk-size: 4096M
93-
script: ./gradlew sentry-android-integration-tests:sentry-uitest-android:connectedReleaseAndroidTest -Denvironment=github --daemon
93+
script: ./gradlew -p sentry-android-integration-tests :sentry-uitest-android:connectedReleaseAndroidTest -Denvironment=github --daemon
9494

9595
- name: Upload test results
9696
if: always()

‎.github/workflows/format-code.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
run: |
2828
./gradlew spotlessApply
2929
./gradlew -p sentry-samples/sentry-samples-android spotlessApply
30+
./gradlew -p sentry-android-integration-tests spotlessApply
3031
3132
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore
3233
# we need to pass the current branch, otherwise we can't commit the changes.

‎.github/workflows/integration-tests-size.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ jobs:
4141
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
4242

4343
- name: Size Analysis
44-
run: ./gradlew :sentry-android-integration-tests:test-app-size:bundleRelease
44+
run: ./gradlew -p sentry-android-integration-tests :test-app-size:bundleRelease
4545
env:
4646
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ resolves the per-module test task, including integration test suites, for you.
5959

6060
### Android-Specific Commands
6161
```bash
62-
# Assemble Android test APKs
63-
./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest
62+
# Assemble Android test APKs, in a separate Gradle build that includes this one
63+
./gradlew -p sentry-android-integration-tests :sentry-uitest-android:assembleRelease :sentry-uitest-android:assembleAndroidTest
6464

6565
# Run critical UI tests
6666
./scripts/test-ui-critical.sh

‎Makefile‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check checkSampleAndroid preMerge publish
1+
.PHONY: all clean compile javadocs dryRelease update checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check checkSampleAndroid checkIntegrationTests preMerge publish
22

33
all: stop clean javadocs compile
44
assembleUiTests: assembleUiTestRelease
5-
preMerge: check checkSampleAndroid
5+
preMerge: check checkSampleAndroid checkIntegrationTests
66
publish: clean dryRelease
77

88
# deep clean
@@ -30,18 +30,19 @@ update:
3030
checkFormat:
3131
./gradlew spotlessJavaCheck spotlessKotlinCheck
3232
./gradlew -p sentry-samples/sentry-samples-android spotlessJavaCheck spotlessKotlinCheck
33+
./gradlew -p sentry-android-integration-tests spotlessJavaCheck spotlessKotlinCheck
3334

3435
# Binary compatibility validator
3536
api:
3637
./gradlew apiDump
3738

3839
# Assemble release and Android test apk of the uitest-android module
3940
assembleUiTestRelease:
40-
./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest
41+
./gradlew -p sentry-android-integration-tests :sentry-uitest-android:assembleRelease :sentry-uitest-android:assembleAndroidTest
4142

4243
# Assemble release of the uitest-android-critical module
4344
assembleUiTestCriticalRelease:
44-
./gradlew :sentry-android-integration-tests:sentry-uitest-android-critical:assembleRelease
45+
./gradlew -p sentry-android-integration-tests :sentry-uitest-android-critical:assembleRelease
4546

4647
# Run Maestro tests for the uitest-android-critical module
4748
runUiTestCritical:
@@ -54,3 +55,7 @@ check:
5455
# The Android sample is a separate build, so the root `check` doesn't reach it
5556
checkSampleAndroid:
5657
./gradlew -p sentry-samples/sentry-samples-android check
58+
59+
# The Android integration tests are a separate build, so the root `check` doesn't reach them
60+
checkIntegrationTests:
61+
./gradlew -p sentry-android-integration-tests check

‎build.gradle.kts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ apiValidation {
7676
"sentry-samples-spring-boot-4-otlp",
7777
"sentry-samples-spring-boot-4-webflux",
7878
"sentry-samples-ktor-client",
79-
"sentry-uitest-android",
80-
"sentry-uitest-android-critical",
81-
"test-app-size",
8279
"sentry-samples-netflix-dgs",
8380
"sentry-samples-console-otlp",
8481
"sentry-test-support"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Android performance-impact and integration tests
22

3+
This directory is a separate Gradle build that includes the SDK build, so run its tasks with
4+
`./gradlew -p sentry-android-integration-tests <task>`. The SDK build doesn't include it, so
5+
`./gradlew` from the repository root doesn't build, lint or format these apps.
6+
37
* [Espresso-based UI tests](./sentry-uitest-android) - run within SauceLabs (see /.sauce/*.yml)
48
* Also used for compatibility test matrix against new AGP versions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Loads the plugins once for every subproject, so they all share one classpath.
2+
plugins {
3+
alias(libs.plugins.android.application) apply false
4+
alias(libs.plugins.kotlin.android) apply false
5+
alias(libs.plugins.kotlin.compose) apply false
6+
alias(libs.plugins.errorprone) apply false
7+
alias(libs.plugins.detekt) apply false
8+
alias(libs.plugins.gradle.versions) apply false
9+
alias(libs.plugins.sentry) apply false
10+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Gradle properties are per build, so this repeats what these apps need from the SDK build's
2+
# gradle.properties. settings.gradle.kts reads the SDK version from that file.
3+
4+
org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=2g -XX:+CrashOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC
5+
org.gradle.caching=true
6+
org.gradle.parallel=true
7+
org.gradle.configureondemand=true
8+
org.gradle.configuration-cache=true
9+
org.gradle.configuration-cache.parallel=true
10+
11+
android.useAndroidX=true
12+
# AGP 9+ migration opt-outs until we remove kotlin-android plugin and adopt built-in Kotlin.
13+
android.builtInKotlin=false
14+
android.newDsl=false
15+
16+
android.defaults.buildfeatures.renderscript=false
17+
android.defaults.buildfeatures.shaders=false
18+
android.defaults.buildfeatures.aidl=false
19+
android.defaults.buildfeatures.resvalues=false
20+
android.nonTransitiveRClass=true
21+
22+
kotlin.stdlib.default.dependency=false
23+
24+
systemProp.org.gradle.internal.http.socketTimeout=120000

‎sentry-android-integration-tests/sentry-uitest-android-critical/build.gradle.kts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ plugins {
55
id("com.android.application")
66
alias(libs.plugins.kotlin.android)
77
alias(libs.plugins.kotlin.compose)
8+
id("io.sentry.spotless")
9+
id("io.sentry.jdk-target")
810
}
911

12+
val sentryVersion = libs.versions.sentry.get()
13+
1014
android {
1115
compileSdk = libs.versions.compileSdk.get().toInt()
1216
compileSdkMinor = libs.versions.compileSdkMinor.get().toInt()
@@ -47,7 +51,7 @@ dependencies {
4751
implementation(libs.androidx.compose.material3)
4852
implementation(libs.androidx.constraintlayout)
4953
implementation(libs.androidx.core)
50-
implementation(projects.sentryAndroidCore)
54+
implementation("io.sentry:sentry-android-core:$sentryVersion")
5155
}
5256

5357
tasks.withType<Detekt>().configureEach {

0 commit comments

Comments
 (0)