Skip to content

Commit bcf6f40

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 645b4cf commit bcf6f40

13 files changed

Lines changed: 162 additions & 26 deletions

File tree

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

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

9090
- name: Upload test results
9191
if: always()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ jobs:
2929
uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
3030

3131
- name: Size Analysis
32-
run: ./gradlew :sentry-android-integration-tests:test-app-size:bundleRelease
32+
run: ./gradlew -p sentry-android-integration-tests :test-app-size:bundleRelease
3333
env:
3434
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: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.PHONY: all clean compile javadocs dryRelease update format checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check preMerge publish
1+
.PHONY: all clean compile javadocs dryRelease update format checkFormat api assembleUiTestRelease assembleUiTestCriticalRelease runUiTestCritical check checkIntegrationTests preMerge publish
22

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

88
# deep clean
@@ -29,23 +29,25 @@ update:
2929
format:
3030
./gradlew spotlessApply
3131
./gradlew -p sentry-samples/sentry-samples-android spotlessApply
32+
./gradlew -p sentry-android-integration-tests spotlessApply
3233

3334
# Spotless check's code
3435
checkFormat:
3536
./gradlew spotlessJavaCheck spotlessKotlinCheck
3637
./gradlew -p sentry-samples/sentry-samples-android spotlessJavaCheck spotlessKotlinCheck
38+
./gradlew -p sentry-android-integration-tests spotlessJavaCheck spotlessKotlinCheck
3739

3840
# Binary compatibility validator
3941
api:
4042
./gradlew updateKotlinAbi
4143

4244
# Assemble release and Android test apk of the uitest-android module
4345
assembleUiTestRelease:
44-
./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest
46+
./gradlew -p sentry-android-integration-tests :sentry-uitest-android:assembleRelease :sentry-uitest-android:assembleAndroidTest
4547

4648
# Assemble release of the uitest-android-critical module
4749
assembleUiTestCriticalRelease:
48-
./gradlew :sentry-android-integration-tests:sentry-uitest-android-critical:assembleRelease
50+
./gradlew -p sentry-android-integration-tests :sentry-uitest-android-critical:assembleRelease
4951

5052
# Run Maestro tests for the uitest-android-critical module
5153
runUiTestCritical:
@@ -54,3 +56,7 @@ runUiTestCritical:
5456
# Run tests and lint
5557
check:
5658
./gradlew check
59+
60+
# The Android integration tests are a separate build, so the root `check` doesn't reach them
61+
checkIntegrationTests:
62+
./gradlew -p sentry-android-integration-tests check
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 {

‎sentry-android-integration-tests/sentry-uitest-android/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ By default the envelopes sent to relay are caught by a mock server which allows
55

66
# How to use
77

8-
Simply run `./gradlew connectedCheck` to run all ui tests of all modules (requires a connected device, either physical or an emulator).
8+
Simply run `./gradlew -p sentry-android-integration-tests connectedCheck` to run all ui tests of all modules (requires a connected device, either physical or an emulator).
99

1010
# SauceLabs
1111
To run on saucelabs execute following commands (need also `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables):
1212
For End 2 End:
1313
```
14-
./gradlew :sentry-android-integration-tests:sentry-uitest-android:assembleRelease :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest
14+
./gradlew -p sentry-android-integration-tests :sentry-uitest-android:assembleRelease :sentry-uitest-android:assembleAndroidTest
1515
saucectl run -c .sauce/sentry-uitest-android-end2end.yml
1616
```
1717

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ plugins {
99
alias(libs.plugins.errorprone)
1010
alias(libs.plugins.gradle.versions)
1111
alias(libs.plugins.detekt)
12+
id("io.sentry.spotless")
13+
id("io.sentry.jdk-target")
1214
}
1315

16+
val sentryVersion = libs.versions.sentry.get()
17+
1418
android {
1519
compileSdk = libs.versions.compileSdk.get().toInt()
1620
compileSdkMinor = libs.versions.compileSdkMinor.get().toInt()
@@ -46,7 +50,7 @@ android {
4650

4751
signingConfigs {
4852
getByName("debug") {
49-
storeFile = rootProject.file("debug.keystore")
53+
storeFile = file("../../debug.keystore")
5054
storePassword = "android"
5155
keyAlias = "androiddebugkey"
5256
keyPassword = "android"
@@ -90,10 +94,10 @@ dependencies {
9094
implementation(kotlin("stdlib-jdk8", getKotlinPluginVersion()))
9195

9296
if (applySentryIntegrations) {
93-
implementation(projects.sentryAndroid)
94-
implementation(projects.sentryCompose)
97+
implementation("io.sentry:sentry-android:$sentryVersion")
98+
implementation("io.sentry:sentry-compose:$sentryVersion")
9599
} else {
96-
implementation(projects.sentryAndroidCore)
100+
implementation("io.sentry:sentry-android-core:$sentryVersion")
97101
}
98102
implementation(libs.androidx.appcompat)
99103
implementation(libs.androidx.activity.compose)
@@ -112,7 +116,7 @@ dependencies {
112116
errorprone(libs.nullaway)
113117

114118
androidTestUtil(libs.androidx.test.orchestrator)
115-
androidTestImplementation(projects.sentryTestSupport)
119+
androidTestImplementation("io.sentry:sentry-test-support:$sentryVersion")
116120
androidTestImplementation(libs.androidx.test.core.ktx)
117121
androidTestImplementation(libs.androidx.test.espresso.core)
118122
androidTestImplementation(libs.androidx.test.ext.junit)
@@ -132,6 +136,12 @@ tasks.withType<JavaCompile>().configureEach {
132136
}
133137
}
134138

139+
detekt {
140+
buildUponDefaultConfig = true
141+
allRules = true
142+
config.setFrom(file("../../detekt.yml"))
143+
}
144+
135145
tasks.withType<Detekt>().configureEach {
136146
// Target version of the generated JVM bytecode. It is used for type resolution.
137147
jvmTarget = JavaVersion.VERSION_1_8.toString()

0 commit comments

Comments
 (0)