Skip to content

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

Merged
merged 3 commits into from
May 23, 2025
Merged

Conversation

whyoleg
Copy link
Collaborator

@whyoleg whyoleg commented Nov 1, 2024

NOTE: depends on #3899

Fixes #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

@whyoleg whyoleg self-assigned this Nov 1, 2024
@whyoleg whyoleg requested review from adam-enko and removed request for vmishenev and adam-enko January 31, 2025 09:32
@whyoleg whyoleg changed the base branch from master to drop-kx.serialization-plugin January 31, 2025 11:03
This was referenced Jan 31, 2025
@adam-enko adam-enko added this to the Dokka 2.1.0 milestone Mar 10, 2025
@adam-enko adam-enko self-requested a review May 21, 2025 09:38
@@ -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" }
Copy link
Member

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?

Copy link
Member

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.

Copy link
Collaborator Author

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?

Copy link
Collaborator Author

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)
Copy link
Collaborator Author

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? :)

Copy link
Member

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?

Copy link
Member

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.

Base automatically changed from drop-kx.serialization-plugin to master May 23, 2025 13:54
@whyoleg whyoleg force-pushed the compiler-2.0.20 branch from b4a8583 to cc4b4a8 Compare May 23, 2025 14:00
@whyoleg whyoleg merged commit 4c903d0 into master May 23, 2025
15 of 17 checks passed
@whyoleg whyoleg deleted the compiler-2.0.20 branch May 23, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prepare for migration to KGP 2.1.0
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy