1- import org.jetbrains.dokka.gradle.*
21import java.net.*
32
43
@@ -7,75 +6,45 @@ plugins {
76}
87
98val knit_version: String by project
10- private val projetsWithoutDokka = unpublished + " kotlinx-coroutines-bom" + jdk8ObsoleteModule
11- private val coreModuleDocsUrl = " https://kotlinlang.org/api/kotlinx.coroutines/$coreModule /"
12- private val coreModuleDocsPackageList = " $projectDir /kotlinx-coroutines-core/build/dokka/htmlPartial/package-list"
9+ private val projectsWithoutDokka = unpublished + " kotlinx-coroutines-bom" + jdk8ObsoleteModule
10+ private val subprojectWithDokka = subprojects.filterNot { projectsWithoutDokka.contains(it.name) }
1311
14- configure(subprojects.filterNot { projetsWithoutDokka.contains(it.name) } ) {
12+ configure(subprojectWithDokka ) {
1513 apply (plugin = " org.jetbrains.dokka" )
1614 configurePathsaver()
15+ configureDokkaTemplatesDir()
1716 condigureDokkaSetup()
18- configureExternalLinks()
1917}
2018
21- // Setup top-level 'dokkaHtmlMultiModule' with templates
22- tasks.withType<DokkaMultiModuleTask >().named(" dokkaHtmlMultiModule" ) {
23- setupDokkaTemplatesDir(this )
24- }
19+ // For top-level multimodule collection
20+ configurePathsaver()
21+ configureDokkaTemplatesDir()
2522
2623dependencies {
27- // Add explicit dependency between Dokka and Knit plugin
28- add(" dokkaHtmlMultiModulePlugin" , " org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version " )
24+ subprojectWithDokka.forEach {
25+ dokka(it)
26+ }
2927}
3028
3129// Dependencies for Knit processing: Knit plugin to work with Dokka
3230private fun Project.configurePathsaver () {
33- tasks.withType(DokkaTaskPartial ::class ).configureEach {
34- dependencies {
35- plugins(" org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version " )
36- }
31+ dependencies {
32+ dokkaPlugin(" org.jetbrains.kotlinx:dokka-pathsaver-plugin:$knit_version " )
3733 }
3834}
3935
4036// Configure Dokka setup
4137private fun Project.condigureDokkaSetup () {
42- tasks.withType( DokkaTaskPartial :: class ).configureEach {
43- suppressInheritedMembers = true
44- setupDokkaTemplatesDir( this )
45-
38+ dokka {
39+ dokkaPublications.configureEach {
40+ suppressInheritedMembers = true
41+ }
4642 dokkaSourceSets.configureEach {
4743 jdkVersion = 11
4844 includes.from(" README.md" )
49- noStdlibLink = true
50-
51- externalDocumentationLink {
52- url = URL (" https://kotlinlang.org/api/latest/jvm/stdlib/" )
53- packageListUrl = rootProject.projectDir.toPath().resolve(" site/stdlib.package.list" ).toUri().toURL()
54- }
55-
56- // Something suspicious to figure out, probably legacy of earlier days
57- if (! project.isMultiplatform) {
58- dependsOn(project.configurations[" compileClasspath" ])
59- }
60- }
61-
62- // Source links
63- dokkaSourceSets.configureEach {
6445 sourceLink {
6546 localDirectory = rootDir
66- remoteUrl = URL (" https://github.com/kotlin/kotlinx.coroutines/tree/master" )
67- remoteLineSuffix = " #L"
68- }
69- }
70- }
71- }
72-
73- private fun Project.configureExternalLinks () {
74- tasks.withType<DokkaTaskPartial >() {
75- dokkaSourceSets.configureEach {
76- externalDocumentationLink {
77- url = URL (coreModuleDocsUrl)
78- packageListUrl = File (coreModuleDocsPackageList).toURI().toURL()
47+ remoteUrl(" https://github.com/kotlin/kotlinx.coroutines/tree/master" )
7948 }
8049 }
8150 }
@@ -90,10 +59,10 @@ private fun Project.configureExternalLinks() {
9059 * - Template setup: https://github.com/JetBrains/kotlin-web-site/blob/master/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesPrepareDokkaTemplates.kt
9160 * - Templates repository: https://github.com/JetBrains/kotlin-web-site/tree/master/dokka-templates
9261 */
93- private fun Project.setupDokkaTemplatesDir ( dokkaTask : AbstractDokkaTask ) {
94- dokkaTask.pluginsMapConfiguration = mapOf (
95- " org.jetbrains.dokka.base.DokkaBase " to """ { "templatesDir" : " $ {
96- project.rootProject.projectDir.toString().replace( ' \\ ' , ' / ' )
97- } /dokka-templates" } """
98- )
62+ private fun Project.configureDokkaTemplatesDir ( ) {
63+ dokka {
64+ pluginsConfiguration.html {
65+ templatesDir = rootDir.resolve( " dokka-templates " )
66+ }
67+ }
9968}
0 commit comments