Move gradle-plugin dependencies to the version catalog#3033
Move gradle-plugin dependencies to the version catalog#3033KlyneChrysler wants to merge 2 commits into
Conversation
Third slice of google#2968. Adds the Kotlin Gradle plugin artifacts, AGP, and Truth to the catalog; generateKSPVersions reads the coroutines version from the catalog. googleTruthVersion is removed from gradle.properties as gradle-plugin was its last consumer. kotlinBaseVersion stays: TestConfig loads gradle.properties directly at test runtime.
jaschdoc
left a comment
There was a problem hiding this comment.
Thank you for another contribution. I just have one question before proceeding.
| compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinBaseVersion") | ||
| compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlinBaseVersion") | ||
| compileOnly(libs.kotlin.gradle.plugin.api) | ||
| compileOnly(libs.kotlin.gradle.plugin.asProvider()) |
There was a problem hiding this comment.
Could you explain why this is required .asProvider()? :)
There was a problem hiding this comment.
The catalog has both kotlin-gradle-plugin and kotlin-gradle-plugin-api, so kotlin-gradle-plugin is simultaneously a leaf alias and a prefix of another alias.
In that case Gradle's generated type safe accessor libs.kotlin.gradle.plugin is an accessor group rather than a dependency provider, and the leaf has to be selected explicitly with .asProvider(). Without it the build script does not compile.
If you prefer cleaner call sites I am happy to rename the aliases instead, for example kotlinGradlePlugin and kotlinGradlePluginApi, which avoids the prefix collision entirely.
There was a problem hiding this comment.
Sounds good, thank you for the explanation. Please rename such that the use site is libs.kotlin.gradlePluginApi and libs.kotlin.gradlePlugin.
jaschdoc
left a comment
There was a problem hiding this comment.
Just a minor renaming around the gradle plugin api. Looks good otherwise :)
| compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinBaseVersion") | ||
| compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlinBaseVersion") | ||
| compileOnly(libs.kotlin.gradle.plugin.api) | ||
| compileOnly(libs.kotlin.gradle.plugin.asProvider()) |
There was a problem hiding this comment.
Sounds good, thank you for the explanation. Please rename such that the use site is libs.kotlin.gradlePluginApi and libs.kotlin.gradlePlugin.
Third slice of #2968, following #3026 and #3031.
The Kotlin Gradle plugin artifacts, kotlin-compiler-embeddable, AGP, and Truth move to catalog accessors, and the generateKSPVersions task reads the coroutines version from the catalog. googleTruthVersion is removed from gradle.properties since gradle-plugin was its last consumer. kotlinBaseVersion stays because TestConfig loads gradle.properties directly at test runtime.
Verified that resolution is unchanged: ./gradlew :gradle-plugin:dependencies output for the compile, runtime, testCompile, and testRuntime classpaths is identical before and after this commit. :gradle-plugin:compileTestKotlin passes.