Skip to content

Commit

Permalink
Disable CInteropMetadataDependencyTransformationTask tasks during Dokka
Browse files Browse the repository at this point in the history
Partially workaround Kotlin/dokka#2977
Still need to run transformCommonMainDependenciesMetadata and fix missing files in paging modules before publishToMavenLocal succeeds
  • Loading branch information
jeffdgr8 committed May 17, 2023
1 parent 6e807a0 commit 6265489
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")

import org.jetbrains.dokka.gradle.AbstractDokkaTask
import org.jetbrains.kotlin.gradle.targets.native.internal.CInteropMetadataDependencyTransformationTask

plugins {
kotlin("multiplatform") version "1.9.0-Beta-152" apply false
id("org.jetbrains.dokka") version "1.8.10" apply false
Expand All @@ -16,6 +21,24 @@ allprojects {
val cblVersion = rootProject.libs.versions.couchbase.lite.java.get()
val kmpVersion = property("VERSION") as String
version = "$cblVersion-$kmpVersion"

// Workaround for https://github.com/Kotlin/dokka/issues/2977.
// We disable the C Interop IDE metadata task when generating documentation using Dokka.
gradle.taskGraph.whenReady {
val hasDokkaTasks = allTasks.any {
it is AbstractDokkaTask
}
if (hasDokkaTasks) {
tasks.withType<CInteropMetadataDependencyTransformationTask>().configureEach {
enabled = false
}
}
}

// Note transformCommonMainDependenciesMetadata needs to be run first before publishToMavenLocal
// and even still, paging modules are missing a file generated in other modules
// build/kotlinTransformedCInteropMetadataLibraries/iosMain/.couchbase-lite-paging-iosMain.cinteropLibraries
// copy from ktx modules and fix file path, then publishToMavenLocal will succeed
}

tasks.register("clean", Delete::class) {
Expand Down

0 comments on commit 6265489

Please sign in to comment.