-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Migrate to DGPv2 #4436
Conversation
Otherwise, fails with "Cannot run Project.afterEvaluate(Action) when the project is already evaluated."
NB: not tested, waits for KT-71784
Co-authored-by: Adam <152864218+adam-enko@users.noreply.github.com>
@@ -287,7 +288,7 @@ artifacts { | |||
} | |||
|
|||
// Workaround for https://github.com/Kotlin/dokka/issues/1833: make implicit dependency explicit | |||
tasks.named("dokkaHtmlPartial") { | |||
tasks.withType<DokkaBaseTask>() { |
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.
@adam-enko, this is still required. Could you check what happens 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.
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?
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.
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.
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'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.
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.
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?
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.
In any case, I would say it's not blocking the migration to DGPv2
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