-
Notifications
You must be signed in to change notification settings - Fork 432
Use fixated Kotlin compiler 2.0.20 for compiling Dokka #3896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
866ae14
to
f74aa3d
Compare
f74aa3d
to
2989dc4
Compare
2989dc4
to
b7071da
Compare
build-logic/src/main/kotlin/dokkabuild/utils/gradleKotlinCompatibility.kt
Show resolved
Hide resolved
@@ -142,8 +145,6 @@ kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli-jvm", version.ref = | |||
#### Test dependencies #### | |||
eclipse-jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "eclipse-jgit" } | |||
|
|||
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "gradlePlugin-kotlin" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was kotlin-test
removed from the version catalog?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you want the version of kotlin-test-junit5
to default to the version provided by KGP, and not the Kotlin version defined in the version catalog?
If so, does it achieve the same thing to remove version.ref
from the dependency? The dep can then be added as normal, but without a version. KGP should then set the version.
I'd like to keep all of the dependencies consistently defined in the version catalog, but if the workaround above doesn't work then we can stick with this approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that was the intention. If we just use kotlin("test")
in Gradle scripts, KGP will automatically set the version provided via the compilerVersion
DSL instead of the KGP version.
For me, it's fine both ways if the behavior stays the same. However, we do use kotlin("reflect")
, kotlin("test")
, and kotlin("test-junit5")
all over the codebase a lot, so maybe it makes sense to just do it as a separate PR and use the version catalog everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JIC: kotlin(xxx)
is defined as:
fun DependencyHandler.kotlin(module: String, version: String? = null): Any =
"org.jetbrains.kotlin:kotlin-$module${version?.let { ":$version" } ?: ""}"
So I believe that just dropping version.ref in the version catalog should work nicely.
Also, we will be able to leave a comment which explains the idea why we don't have versions there.
So yes, I like your idea, but let's do it in another PR. I will create PR then shortly after this is merged.
/** Indicates whether Kotlin compatibility with older Gradle versions should be enforced */ | ||
val enforceGradleKotlinCompatibility: Provider<Boolean> = | ||
dokkaProperty("enforceGradleKotlinCompatibility", String::toBoolean) | ||
.orElse(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While looking at the PR diff, I found that it's a bit inconsistent that it has a true
default value.
I mean, to enforce language version 1.4, we anyway need to have kotlin.compiler.runViaBuildToolsApi=true
in gradle.properties, so it makes more sense to also have org.jetbrains.dokka.enforceGradleKotlinCompatibility=true
near it
So, @adam-enko, quick question (yes or no), WDYT about flipping the default here? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about changing the default to be the value of runViaBuildToolsApi
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way makes sense to me - feel free to change the default.
NOTE: depends on #3899Fixes #3855
For now the version of the Kotlin compiler and Kotlin Gradle plugin are the same, but it will change when we migrate to KGP 2.1.0