From a44070cfd5acb9caaae640cb276b0adaee8a3a76 Mon Sep 17 00:00:00 2001 From: Nek-12 Date: Mon, 29 May 2023 19:30:35 +0300 Subject: [PATCH] use another solution for disabling CInteropCommonization for when generating docs https://github.com/Kotlin/dokka/issues/2977 --- build.gradle.kts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f1e6a77..c999f3c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import nl.littlerobots.vcu.plugin.versionCatalogUpdate +import org.jetbrains.dokka.gradle.AbstractDokkaTask @Suppress("DSL_SCOPE_VIOLATION") plugins { @@ -33,6 +34,17 @@ subprojects { } tasks { + // TODO: https://github.com/Kotlin/dokka/issues/2977 + val taskClass = + "org.jetbrains.kotlin.gradle.targets.native.internal.CInteropMetadataDependencyTransformationTask" + withType(Class.forName(taskClass) as Class) { + onlyIf { + val executed = gradle.taskGraph.allTasks.none { it is AbstractDokkaTask } + if (!executed) println("w: Disabling CInteropCommonization") + executed + } + + } register("dokkaJavadocJar") { // TODO: Dokka does not support javadocs for multiplatform dependencies // dependsOn(dokkaJavadoc) @@ -122,15 +134,3 @@ tasks { } } } - -// TODO: https://github.com/Kotlin/dokka/issues/2977 -val taskClass = "org.jetbrains.kotlin.gradle.targets.native.internal.CInteropMetadataDependencyTransformationTask" -gradle.taskGraph.whenReady { - val hasDokkaTasks = gradle.taskGraph.allTasks.any { it is org.jetbrains.dokka.gradle.AbstractDokkaTask } - if (hasDokkaTasks) { - @Suppress("UNCHECKED_CAST") - tasks.withType(Class.forName(taskClass) as Class).configureEach { - enabled = false - } - } -}