Skip to content

Commit

Permalink
use another solution for disabling CInteropCommonization for when gen…
Browse files Browse the repository at this point in the history
…erating docs

Kotlin/dokka#2977
  • Loading branch information
Nek-12 committed May 29, 2023
1 parent 5336738 commit a44070c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import nl.littlerobots.vcu.plugin.versionCatalogUpdate
import org.jetbrains.dokka.gradle.AbstractDokkaTask

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
Expand Down Expand Up @@ -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<Task>) {
onlyIf {
val executed = gradle.taskGraph.allTasks.none { it is AbstractDokkaTask }
if (!executed) println("w: Disabling CInteropCommonization")
executed
}

}
register<org.gradle.jvm.tasks.Jar>("dokkaJavadocJar") {
// TODO: Dokka does not support javadocs for multiplatform dependencies
// dependsOn(dokkaJavadoc)
Expand Down Expand Up @@ -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<Task>).configureEach {
enabled = false
}
}
}

0 comments on commit a44070c

Please sign in to comment.