diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index e133a5e6d9..a02b182238 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -228,8 +228,15 @@ jobs: - name: Assemble Universal APK run: | echo "gradle_time_start=$(date +%s)" >> $GITHUB_ENV - flox activate -d flox/base -- ./gradlew :app:assembleV8Debug --no-daemon + set -o pipefail + flox activate -d flox/base -- ./gradlew :app:assembleV8Debug --no-daemon 2>&1 | tee "$RUNNER_TEMP/assemble.log" echo "gradle_time_end=$(date +%s)" >> $GITHUB_ENV + # D8 logs this (non-fatal) once per class when the pinned R8 is older than the Kotlin + # metadata version, burying every real diagnostic. See the `r8` pin in libs.versions.toml. + if grep -q "Unexpected error during rewriting of Kotlin metadata" "$RUNNER_TEMP/assemble.log"; then + echo "::error::D8 could not rewrite Kotlin metadata. Most likely the R8 pinned in gradle/libs.versions.toml is older than the Kotlin metadata version (bump 'r8'), or the pin no longer takes effect on the build classpath. See ADFA-6822." + exit 1 + fi - name: Find APK file diff --git a/build.gradle.kts b/build.gradle.kts index 15a7836cc3..06e157dd22 100755 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -62,6 +62,8 @@ jacoco { buildscript { dependencies { + // Must stay first: pins a D8/R8 that understands the Kotlin metadata version (ADFA-6822). + classpath(libs.android.r8) classpath(libs.kotlin.gradle.plugin) classpath(libs.nav.safe.args.gradle.plugin) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3ca884d690..cdc27caaf2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -19,6 +19,7 @@ gson = "2.10.1" junit-jupiter = "5.10.2" anroidx-test-core = "2.2.0" koinAndroid = "4.1.1" +# A Kotlin minor bump may need a newer `r8` (see its entry below, ADFA-6822). kotlin = "2.3.0" kotlin-coroutines = "1.9.0" kotlinxCoroutinesCore = "1.10.2" @@ -37,6 +38,9 @@ ksp = "2.3.6" antlr4 = "4.13.1" androidx-work = "2.10.0" androidx-espresso = "3.5.1" +# Pinned ahead of AGP on the root buildscript classpath: AGP 8.8.2's bundled D8 8.8.34 cannot rewrite +# Kotlin 2.3 metadata. Bump with `kotlin`; remove once AGP is upgraded (ADFA-6837). +r8 = "8.13.25" retrofit = "2.11.0" markwon = "4.6.2" maven-publish-plugin = "0.27.0" @@ -324,6 +328,7 @@ tooling-slf4j = { module = "org.slf4j:slf4j-api", version = "2.0.17" } snakeyaml-engine = { module = "org.snakeyaml:snakeyaml-engine", version = "2.10" } # Classpaths +android-r8 = { module = "com.android.tools:r8", version.ref = "r8" } android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" } kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } nav-safe-args-gradle-plugin = { module = "androidx.navigation:navigation-safe-args-gradle-plugin", version.ref = "androidx-navigation" }