Skip to content

Commit 26d8708

Browse files
ParaskP7claude
andcommitted
Build: Add kotlin-metadata-jvm override for dependency analysis
Force a newer kotlin-metadata-jvm onto the root buildscript classpath so the dependency analysis plugin's ExplodeJarTask can read Kotlin 2.4.0 metadata instead of failing with "Provided Metadata instance has version 2.4.0, while maximum supported version is 2.3.0". The project's own Kotlin bump to 2.4.10 (#23086) makes every module emit 2.4.0 metadata, which exceeds the 2.3.0 cap of the kotlin-metadata-jvm:2.2.21 reader that dependency-analysis 3.17.0 bundles, so buildHealth's explodeJar tasks fail on the weekly CI job. DAGP resolves kotlin-metadata-jvm unshaded into the same buildscript classpath configuration used here, so Gradle's ordinary conflict resolution upgrades both to the higher version (2.2.21 -> 2.4.10). Pinned to this project's own Kotlin version so it never forces a newer kotlin-stdlib onto DAGP's classpath than the project already uses elsewhere. Interim workaround endorsed by the plugin author; removable once upstream isolates kotlin-metadata-jvm onto its own worker classpath: autonomousapps/dependency-analysis-gradle-plugin#1661 autonomousapps/dependency-analysis-gradle-plugin#1719 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3ab17e4 commit 26d8708

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ import com.automattic.android.measure.reporters.SlowSlowTasksMetricsReporter
44
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
55
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
66

7+
buildscript {
8+
dependencies {
9+
// TODO: Remove once dependency-analysis-gradle-plugin isolates its kotlin-metadata-jvm
10+
// dependency onto its own worker classpath, making this override moot (see PR below).
11+
// Interim workaround, endorsed by the plugin author, for reading Kotlin metadata newer
12+
// than DAGP's own bundled reader supports. Tracks this project's own Kotlin version.
13+
// https://github.com/autonomousapps/dependency-analysis-gradle-plugin/issues/1661
14+
// https://github.com/autonomousapps/dependency-analysis-gradle-plugin/pull/1719
15+
classpath(libs.kotlin.metadata.jvm)
16+
}
17+
}
18+
719
plugins {
820
alias(libs.plugins.detekt)
921
alias(libs.plugins.automattic.measure.builds)

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ jsoup = { group = "org.jsoup", name = "jsoup", version.ref = "jsoup" }
239239
junit = { group = "junit", name = "junit", version.ref = "junit" }
240240
kotlin-compile-testing-ksp = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing-ksp", version.ref = "kotlin-compile-testing" }
241241
kotlin-compile-testing-main = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing", version.ref = "kotlin-compile-testing" }
242+
kotlin-metadata-jvm = { group = "org.jetbrains.kotlin", name = "kotlin-metadata-jvm", version.ref = "kotlin-main" }
242243
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin-main" }
243244
kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin-main" }
244245
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }

0 commit comments

Comments
 (0)