Skip to content

Migrate to DGPv2 #4436

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 12 commits into from
Jun 25, 2025
Merged

Migrate to DGPv2 #4436

merged 12 commits into from
Jun 25, 2025

Conversation

whyoleg
Copy link
Contributor

@whyoleg whyoleg commented May 15, 2025

Migrate to new Dokka Gradle Plugin (migration guide)

Based on #4257

Because of the Gradle task name change, the kotlinlang deploy configuration should also be updated.
Related: JetBrains/kotlin-web-site#4845

@whyoleg whyoleg requested a review from dkhalanskyjb May 15, 2025 15:28
@whyoleg whyoleg self-assigned this May 15, 2025
@@ -287,7 +288,7 @@ artifacts {
}

// Workaround for https://github.com/Kotlin/dokka/issues/1833: make implicit dependency explicit
tasks.named("dokkaHtmlPartial") {
tasks.withType<DokkaBaseTask>() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adam-enko, this is still required. Could you check what happens here?

Copy link
Member

@adam-enko adam-enko Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked out your branch, commented out this code, and ran gradle :kotlinx-coroutines-core:dokkaGenerate but didn't see a problem. How can I trigger the error?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay, I needed to run gradle :dokkaGenerate.

> Task :kotlinx-coroutines-core:jvmJar FAILED

[Incubating] Problems report is available at: file:///Users/dev/projects/jetbrains/kotlin/kotlinx.coroutines/build/reports/problems/problems-report.html
42 actionable tasks: 11 executed, 31 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':kotlinx-coroutines-core:jvmJar' (type 'Jar').
  - Gradle detected a problem with the following location: '/Users/dev/projects/jetbrains/kotlin/kotlinx.coroutines/kotlinx-coroutines-core/build/libs/kotlinx-coroutines-core-jvm-1.10.2-SNAPSHOT.jar'.
    
    Reason: Task ':kotlinx-coroutines-core:dokkaGenerateModuleHtml' uses this output of task ':kotlinx-coroutines-core:jvmJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the problem is, and it's hard to figure out.

I'm just speculating, but maybe somehow DGP automatically registers the Dokka SourceSets before KGP has finished creating the jvmJar task, and so the task dependencies aren't correct. I don't know how this could happen, but it seems to describe the result.

If I were to guess, it's because the buildscripts are using cross-project configuration (allproject/subproject) and internal Gradle utilities (org.gradle.kotlin.dsl.support.delegates.ProjectDelegate#configure), so the plugins aren't applied in the correct order.

I think the only way to fix this is to update the buildscripts so they don't use discouraged practices.

Copy link
Contributor Author

@whyoleg whyoleg Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand, :kotlinx-coroutines-core:dokkaGenerateModuleHtml should not depend at all on :kotlinx-coroutines-core:jvmJar in main source sets, because it should rely on sources of the current module + classpath of dependencies.
Another idea could be that jvmJar is needed for one of the test source sets, which is created by KGP, and so added as a Dokka source set, but those are suppressed, and I thought that it should not affect the inputs of the dokkaGenerateModuleHtml task. But maybe I'm wrong, and even if the source set is suppressed, it will affect inputs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, I would say it's not blocking the migration to DGPv2

@whyoleg whyoleg merged commit 52c4755 into develop Jun 25, 2025
1 check passed
@whyoleg whyoleg deleted the whyoleg/dgp-v2 branch June 25, 2025 13:26
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.

4 participants