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

Adrian Landborn

05/31/2022, 11:28 AM
Hi, Is there a way to not overwrite the CSS files or index.html when I run
./gradlew dokkaHtmlMultiModule
? What I am trying to achieve is to replace the path for the logo. 🧵
This is how my project level task looks like.
Copy code
pluginManager.withPlugin("org.jetbrains.dokka") {
    afterEvaluate {
        this.tasks.withType(org.jetbrains.dokka.gradle.DokkaMultiModuleTask::class) {
            outputDirectory.set(file("documentation/html"))
            includes.from("documentation/packages.md")
        }

        dependencies {
            "dokkaHtmlPlugin"("org.jetbrains.dokka:android-documentation-plugin:1.6.21")
        }
    }
}
i

Ignat Beresnev

05/31/2022, 12:07 PM
Hi! Not 100% sure what exactly you're trying to do, but if you want to set a custom logo, it's available in Dokka's configuration Documentation is not very good atm, but there are some examples: https://kotlin.github.io/dokka/1.6.21/user_guide/gradle/usage/#configuration-options
The name for the logo should be
logo-icon.svg
Copy code
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
    customAssets = listOf(file("logo-icon.svg"))
}
a

Adrian Landborn

05/31/2022, 12:34 PM
I have looked through the docs but do not understand where this “pluginConfiguration” should go. I just want to replace the icon basically.
I managed to get this working. Does not look good but it works…
Copy code
pluginManager.withPlugin("org.jetbrains.dokka") {
    afterEvaluate {
        this.tasks.withType(org.jetbrains.dokka.gradle.DokkaMultiModuleTask::class) {
            pluginsMapConfiguration.set(mapOf("org.jetbrains.dokka.base.DokkaBase" to """{ "customAssets": ["${file("documentation/logo-icon.svg")}"] }"""))

            outputDirectory.set(file("documentation/html"))
            includes.from("documentation/packages.md")
        }

        dependencies {
            "dokkaHtmlPlugin"("org.jetbrains.dokka:android-documentation-plugin:1.6.21")
        }
    }

}
The conversion from Groovy to Kotlin however does not look that nice
i

Ignat Beresnev

05/31/2022, 1:11 PM
^ but that's for
.kts
scripts. For groovy you have to use
pluginsMapConfiguration
, unfortunately
a

Adrian Landborn

05/31/2022, 1:14 PM
Isn’t that the other way around. We do use Kotlin DSL
i

Ignat Beresnev

05/31/2022, 1:17 PM
Nope,
pluginsMapConfiguration
is basically for groovy and if you don't want to depend on
dokka-base
in your buildscripts
a

Adrian Landborn

05/31/2022, 1:21 PM
Why do you have the code in “DokkaTaskPartial” I want this in the main gradle file.
i

Ignat Beresnev

05/31/2022, 1:25 PM
You can put it in your main gradle file, it's not related 🙂 It's not that code is in
DokkaTaskPartial
, but it's configuring
DokkaTaskPartial
. Should be just
DokkaTask
if you have a single-module project
a

Adrian Landborn

05/31/2022, 1:29 PM
Then we should be able to use this in the project level gradle file for DokkaMultiModuleTask. Not sure why the imports does not resolve though. 🤔
image.png
i

Ignat Beresnev

05/31/2022, 1:30 PM
Did you add a dependency to
dokka-base
in your buildscript as shown in the gist and the documentation?
Copy code
buildscript {
    dependencies {
       classpath("org.jetbrains.dokka:dokka-base:1.6.21")
    }
}
🙏 2
a

Adrian Landborn

05/31/2022, 1:30 PM
ahh 😄
13 Views