From bf9d9ef3d76faf5fb2cec2a870583e546c85a143 Mon Sep 17 00:00:00 2001 From: berezinant Date: Thu, 22 Aug 2024 16:01:24 +0200 Subject: [PATCH 1/4] feat: added dokka templates directory for kotlinlang --- .../io/conventions/kotlinx-io-dokka.gradle.kts | 2 ++ build.gradle.kts | 3 +++ dokka-templates/README.md | 12 ++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 dokka-templates/README.md diff --git a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts index fc50ede2..e7e3ade6 100644 --- a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts +++ b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts @@ -11,6 +11,8 @@ plugins { } tasks.withType().configureEach { + pluginsMapConfiguration.set(mapOf("org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${projectDir.toString().replace('\\', '/')}/../dokka-templates" }""")) + dokkaSourceSets.configureEach { includes.from("Module.md") diff --git a/build.gradle.kts b/build.gradle.kts index 8d99e3da..c97b63f3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -47,3 +47,6 @@ kover { } } } +tasks.dokkaHtmlMultiModule { + pluginsMapConfiguration.set(mapOf("org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${projectDir.toString().replace('\\', '/')}/dokka-templates" }""")) +} \ No newline at end of file diff --git a/dokka-templates/README.md b/dokka-templates/README.md new file mode 100644 index 00000000..e9cdba00 --- /dev/null +++ b/dokka-templates/README.md @@ -0,0 +1,12 @@ +# Dokka's template customization +To provide unified navigation for all parts of [kotlinlang.org](https://kotlinlang.org/), +the Kotlin Website Team uses this directory to place custom templates in this folder +during the website build time on TeamCity. + +It is not practical to place these templates in the kotlinx.metadata repository because they change from time to time +and aren't related to the library's release cycle. + +The folder is defined as a source for custom templates by the templatesDir property through Dokka's plugin configuration. + +[Here](https://kotlinlang.org/docs/dokka-html.html#templates), you can +find more about the customization of Dokka's HTML output. \ No newline at end of file From 2b858466d0bce4550d0ef6297f1f3ea87f0a7de1 Mon Sep 17 00:00:00 2001 From: Konstantin Chernenko Date: Thu, 10 Oct 2024 18:41:32 +0200 Subject: [PATCH 2/4] Use `projectDir.resolve` Co-authored-by: Filipp Zhinkin --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index c97b63f3..b4650ee7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -48,5 +48,5 @@ kover { } } tasks.dokkaHtmlMultiModule { - pluginsMapConfiguration.set(mapOf("org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${projectDir.toString().replace('\\', '/')}/dokka-templates" }""")) + pluginsMapConfiguration.set(mapOf("org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${projectDir.resolve("dokka-templates")}" }""")) } \ No newline at end of file From 13735d90b0f5011381bed74e9e7af130c97dab53 Mon Sep 17 00:00:00 2001 From: zoobestik Date: Thu, 10 Oct 2024 18:57:55 +0200 Subject: [PATCH 3/4] Move DokkaMultiModuleTask to kotlinx-io-dokka.gradle.kts --- .../conventions/kotlinx-io-dokka.gradle.kts | 21 ++++++++++++++++++- build.gradle.kts | 3 --- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts index e7e3ade6..68815f4b 100644 --- a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts +++ b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts @@ -3,6 +3,7 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file. */ +import org.jetbrains.dokka.gradle.DokkaMultiModuleTask import org.jetbrains.dokka.gradle.DokkaTaskPartial import java.net.URL @@ -11,7 +12,13 @@ plugins { } tasks.withType().configureEach { - pluginsMapConfiguration.set(mapOf("org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${projectDir.toString().replace('\\', '/')}/../dokka-templates" }""")) + pluginsMapConfiguration.set( + mapOf( + "org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${ + projectDir.toString().replace('\\', '/') + }/../dokka-templates" }""" + ) + ) dokkaSourceSets.configureEach { includes.from("Module.md") @@ -36,3 +43,15 @@ tasks.withType().configureEach { ) } } + +tasks.withType(DokkaMultiModuleTask::class.java) { + pluginsMapConfiguration.set( + mapOf( + "org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${ + projectDir.resolve( + "dokka-templates" + ) + }" }""" + ) + ) +} diff --git a/build.gradle.kts b/build.gradle.kts index b4650ee7..8d99e3da 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -47,6 +47,3 @@ kover { } } } -tasks.dokkaHtmlMultiModule { - pluginsMapConfiguration.set(mapOf("org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${projectDir.resolve("dokka-templates")}" }""")) -} \ No newline at end of file From 2f0c9700f2addc5af61894a11e888f2c725f2e2a Mon Sep 17 00:00:00 2001 From: Konstantin Chernenko Date: Thu, 10 Oct 2024 19:20:55 +0200 Subject: [PATCH 4/4] Use `projectDir.resolveSibling` Co-authored-by: Filipp Zhinkin --- .../kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts index 68815f4b..82209d73 100644 --- a/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts +++ b/build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-dokka.gradle.kts @@ -15,8 +15,8 @@ tasks.withType().configureEach { pluginsMapConfiguration.set( mapOf( "org.jetbrains.dokka.base.DokkaBase" to """{ "templatesDir" : "${ - projectDir.toString().replace('\\', '/') - }/../dokka-templates" }""" + projectDir.resolveSibling("dokka-templates") + }""" ) )