-
Notifications
You must be signed in to change notification settings - Fork 411
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
Implicit task dependency when using Gradle 8 + KMP custom cinterop #2977
Comments
I think this might be a KGP issue - more info (plus a workaround) in cashapp/redwood#823 (comment) |
…droidAdapter (#59) * fix getName() in DokkaSourceSetIdSpec.kt * add DokkatooAndroidAdapter * align Kotlin version to match Gradle's embedded Kotlin version * add KotlinPlatform.AndroidJVM, refactor to rename 'key' to 'displayName' * rm deprecated helper in TestFixtures * update test after KotlinPlatform refactor * tidy build config * add kotlinx-coroutines dependency to DokkaGenerator classpath * big ol' refactor of DokkatooKotlinAdapter - tidy up the complication/source set details extractors - move extractors into specific companion objects - update logic to better match DGP code * update API dump * add link to Kotlin/dokka#2977 * refactor DokkatooKotlinAdapter to better organise logic into specific builder utility classes * update conventions for Android/JDK documentation links, so they're enabled dynamically based on the analysis platform * add cacheRoot comment * sort KotlinPlatform alphabetically * tidy up KotlinAdapter, update AndroidAdapter to fetch android.jar, update the configuration-files-fetch logic to fetch JAVA_RUNTIME files * lots of changes, so bump the minor version * remove conditional default for enableJdkDocumentationLink - it seems to result in the wrong Java version in the KotlinMultiplatformExample test...?
Partially workaround Kotlin/dokka#2977 Still need to run transformCommonMainDependenciesMetadata and fix missing files in paging modules before publishToMavenLocal succeeds
Solution I found for Kotlin DSL approach subprojects {
apply(plugin = rootProject.libs.plugins.dokka.id)
tasks {
val taskClass =
"org.jetbrains.kotlin.gradle.targets.native.internal.CInteropMetadataDependencyTransformationTask"
withType(Class.forName(taskClass) as Class<Task>) {
onlyIf { gradle.taskGraph.allTasks.none { it is AbstractDokkaTask } }
}
}
} |
I've been testing the Kotlin 1.9.0 Beta and RC builds and have found some issues this workaround doesn't fully address. With a
If I change the Also, running Dokka tasks on a clean build now results in this error (where
Running |
Composite build doesn't work with Dokka workaround: Kotlin/dokka#2977 (comment)
This approach also has other consequences. We've started seeing failed signature verification and duplicated |
Building on the workarounds discussed and the issues I encountered with Kotlin 1.9.0, I came up with this workaround, which makes all Dokka tasks depend on all tasks.withType<AbstractDokkaTask> {
val className = "org.jetbrains.kotlin.gradle.targets.native.internal.CInteropMetadataDependencyTransformationTask"
@Suppress("UNCHECKED_CAST")
val taskClass = Class.forName(className) as Class<Task>
parent?.subprojects?.forEach {
dependsOn(it.tasks.withType(taskClass))
}
} I've been able to run Dokka tasks successfully from a clean build with Kotlin 1.9.0 with this workaround. Note, this workaround still doesn't work with a |
Partially workaround Kotlin/dokka#2977 Still need to run transformCommonMainDependenciesMetadata and fix missing files in paging modules before publishToMavenLocal succeeds
Composite build doesn't work with Dokka workaround: Kotlin/dokka#2977 (comment)
Do you know what is the interaction with an |
@JakeWharton we haven't had time to investigate the Long story short, Dokka's tasks try to resolve the project's classpath by calling KGP's API, which transitively triggers some KGP tasks, and they fail in one way or another, depending on the project. We have a workaround for Dokka 1.9.0 (#3081), which we have just begun testing and should release some time next week, but I don't know if it addresses this particular problem. If you want, I can publish a I'll provide more details and try to reduce the spread of information about 1.9.0 in the upcoming days. As a side note: really sorry to hear this is happening. People struggling with Dokka is the last thing that we want. We're just having a rough patch where a lot of things are happening at the same time, and we can't address everything, so we have to prioritise. We do have a long-term solution that will address these sorts of problems with KGP hopefully for good (use the same stable API that IDEA uses to resolve classpath), so don't lose hope in Dokka 😅 |
I will gladly test snapshots, dev versions, anything you got! We just moved to be EAP champions as well. Hopefully we can catch problems with EAP/beta/RC releases (whether Dokka-specific or not) earlier than the stable release. |
Probably related to Kotlin/dokka#2977
Probably related to Kotlin/dokka#2977
Dokka 1.9.0 has been released, and it includes some workarounds for this problem. See the following issue for details: To avoid the spread of information and have updates in a single place, I'll close this issue and a few others as duplicates in favour of #3153. |
Describe the bug
You can see the issue here: cashapp/redwood#823. We're trying to upgrade from Gradle 7.6 -> 8.x and see implicit task dependency issues:
To Reproduce
If we remove
kotlin.mpp.enableCInteropCommonization=true
fromgradle.properties
,dokkaHtmlMultiModule
then builds successfullyDokka configuration
https://github.com/cashapp/redwood/blob/trunk/build.gradle#L119
Installation
The text was updated successfully, but these errors were encountered: