https://kotlinlang.org logo
#dokka
Title
s

Sorin

11/24/2020, 3:12 PM
Hi all. I am still struggling configuring the multimodule dokka on android. I am calling as in the documentation :
Copy code
tasks.dokkaHtmlMultiModule.configure {
    outputDirectory.set(buildDir.resolve("dokkaCustomMultiModuleOutput"))
    documentationFileName.set("README.md")
}
m

Marcin Aman

11/24/2020, 3:20 PM
Uh, i think the docs didn't get updated after the
documentationFileName
was removed. This property was removed after the gradle plugin rewrite with an intent to make it sourceSet dependent but we didn't have a chance to do it yet Sorry for the confusion 😿 As for the reason why it doesn't find the task: do you apply it in a 'main' gradle file? Or in submodules?
dokkaHtmlMultimodule
runs
dokkaHtml
tasks on submodules and then copies the results to main docs
s

Sorin

11/24/2020, 3:25 PM
I see, np. I apply it in the submodule, should I use it in the root?
m

Marcin Aman

11/24/2020, 3:33 PM
yes, the multimodule task is on the root level
s

Sorin

11/24/2020, 3:34 PM
I see, so something like this:
Copy code
buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath(kotlin("gradle-plugin", Version.kotlinVersion))
        classpath("com.android.tools.build:gradle:4.0.2")
        classpath("org.jetbrains.dokka:dokka-gradle-plugin:${Version.dokka}")
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

tasks.register("clean").configure {
    delete("build")
}

tasks.dokkaHtmlMultiModule.configure {
 outputDirectory.set(buildDir.resolve("dokkaCustomMultiModuleOutput"))
}
also in the root but not the one in buildSrc right?
and then in the submodules:
Copy code
plugins {
    id("com.android.library")
    id("github-publish")
    kotlin("android")
    id("org.jetbrains.dokka")
}
....

dependencies {

    implementation(kotlin("stdlib", Version.kotlinVersion))

    api(Lib.KotlinX.coroutinesCore)
    api(Lib.KotlinX.coroutinesAndroid)

    api(Lib.mqtt)

    testImplementation(Lib.Test.junit4)
    testImplementation(Lib.Test.junit5Api)
}

tasks.dokkaHtml.configure {
    outputDirectory.set(buildDir.resolve("dokka"))
}
22 Views