From 4cbbdbfef9161425ba2c4f5b1e1dcb49f5065191 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 22 May 2026 10:41:00 -0400 Subject: [PATCH] =?UTF-8?q?chore(android):=20audit-response=20wave=20?= =?UTF-8?q?=E2=80=94=20JUnit=20launcher,=20compileSdk=2036,=20CC=20warn,?= =?UTF-8?q?=20image=20:36,=20Gradle=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes uncovered by the 2026-05-22 build-config audit + the Gradle 9 + JUnit Platform launcher requirement that just surfaced in CI: - testRuntimeOnly junit-platform-launcher: Gradle 9 no longer auto- injects it; tests fail with "Failed to load JUnit Platform" without an explicit dep. - compileSdk + targetSdk 35 -> 36: AGP 9 defaults to 36 and warns on lower values; CI was also auto-downloading build-tools 36 at runtime (now pre-installed in ci-android:36). - container.image bumped to ci-android:36 to match. - configuration-cache.problems=warn in gradle.properties: detekt 2.0- alpha + ktlint Gradle plugin have CC compat holes; warn rather than fail. - androidTest dep parity: kotlin("test") + kotlinx-coroutines-test added (was on testImplementation only). - CI: actions/cache@v4 for ~/.gradle/{caches,wrapper} + ~/.kotlin, keyed on gradle-wrapper.properties + libs.versions.toml + the *.gradle.kts files. Saves ~3 min per run after warm-up. Deferred (with trigger conditions, will land when needed): Hilt testing artifacts + HiltTestRunner (first @HiltAndroidTest), Room Gradle plugin + schemaDirectory (Phase 4.2), Coil 3 ImageLoader factory sharing OkHttp (Phase 5.4), MainDispatcherRule test utility (Phase 5.3), JUnit-5/4 split for instrumented (Phase 5+), NetworkSecurityConfig (pre-cutover Phase 14). Co-Authored-By: Claude Opus 4.7 (1M context) --- .forgejo/workflows/android.yml | 17 +++++++++++++++-- android/app/build.gradle.kts | 12 ++++++++++-- android/gradle.properties | 6 ++++++ android/gradle/libs.versions.toml | 1 + 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/android.yml b/.forgejo/workflows/android.yml index 8a4e377e..08b9a8b5 100644 --- a/.forgejo/workflows/android.yml +++ b/.forgejo/workflows/android.yml @@ -25,7 +25,7 @@ jobs: # android-ci once the operator registers that runner label. runs-on: flutter-ci container: - image: git.fabledsword.com/bvandeusen/ci-android:35 + image: git.fabledsword.com/bvandeusen/ci-android:36 defaults: run: @@ -35,6 +35,19 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Cache Gradle dirs + # Resolved deps + Gradle distribution + Kotlin daemon caches. + # Saves ~3 min per CI run after the first warm-up. + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + ~/.kotlin + key: gradle-${{ runner.os }}-${{ hashFiles('android/gradle/wrapper/gradle-wrapper.properties', 'android/gradle/libs.versions.toml', 'android/**/*.gradle.kts') }} + restore-keys: | + gradle-${{ runner.os }}- + - name: Make gradlew executable run: chmod +x ./gradlew @@ -67,7 +80,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') runs-on: flutter-ci container: - image: git.fabledsword.com/bvandeusen/ci-android:35 + image: git.fabledsword.com/bvandeusen/ci-android:36 defaults: run: diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 4502eab1..95c1f63c 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -14,12 +14,12 @@ plugins { android { namespace = "com.fabledsword.minstrel" - compileSdk = 35 + compileSdk = 36 defaultConfig { applicationId = "com.fabledsword.minstrel" minSdk = 26 - targetSdk = 35 + targetSdk = 36 versionCode = 1 versionName = "0.1.0-native" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" @@ -160,9 +160,17 @@ dependencies { // kotlin.test for assertEquals/assertNull/etc. — version managed by // the applied Kotlin plugin so no explicit version pin needed. testImplementation(kotlin("test")) + // Gradle 9 no longer auto-injects the JUnit Platform launcher; must + // be declared explicitly on the runtime classpath for useJUnitPlatform() + // to discover tests. + testRuntimeOnly(libs.junit.platform.launcher) androidTestImplementation(platform(libs.compose.bom)) androidTestImplementation(libs.compose.ui.test) + // androidTest dep parity with the unit-test side; needed once we have + // instrumented tests that consume the same APIs. + androidTestImplementation(kotlin("test")) + androidTestImplementation(libs.kotlinx.coroutines.test) debugImplementation(libs.compose.ui.test.manifest) } diff --git a/android/gradle.properties b/android/gradle.properties index b605a620..6657f33c 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -4,4 +4,10 @@ org.gradle.caching=true org.gradle.configuration-cache=true android.useAndroidX=true android.nonTransitiveRClass=true + +# detekt 2.0-alpha + ktlint Gradle plugin have intermittent +# configuration-cache compatibility holes. Warn rather than fail so the +# CC speedup applies where it can; revisit when both tools ship stable +# CC-clean releases. +org.gradle.configuration-cache.problems=warn kotlin.code.style=official diff --git a/android/gradle/libs.versions.toml b/android/gradle/libs.versions.toml index 03978ea3..a2cb845d 100644 --- a/android/gradle/libs.versions.toml +++ b/android/gradle/libs.versions.toml @@ -73,6 +73,7 @@ coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil" coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coil" } timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" } +junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version = "1.11.3" } turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } mockk = { module = "io.mockk:mockk", version.ref = "mockk" } compose-ui-test = { module = "androidx.compose.ui:ui-test-junit4" }