1
- import org.jetbrains.dokka.gradle.*
2
1
import java.net.*
3
2
4
3
@@ -7,75 +6,45 @@ plugins {
7
6
}
8
7
9
8
val 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) }
13
11
14
- configure(subprojects.filterNot { projetsWithoutDokka.contains(it.name) } ) {
12
+ configure(subprojectWithDokka ) {
15
13
apply (plugin = " org.jetbrains.dokka" )
16
14
configurePathsaver()
15
+ configureDokkaTemplatesDir()
17
16
condigureDokkaSetup()
18
- configureExternalLinks()
19
17
}
20
18
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()
25
22
26
23
dependencies {
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
+ }
29
27
}
30
28
31
29
// Dependencies for Knit processing: Knit plugin to work with Dokka
32
30
private 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 " )
37
33
}
38
34
}
39
35
40
36
// Configure Dokka setup
41
37
private 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
+ }
46
42
dokkaSourceSets.configureEach {
47
43
jdkVersion = 11
48
44
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 {
64
45
sourceLink {
65
46
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" )
79
48
}
80
49
}
81
50
}
@@ -90,10 +59,10 @@ private fun Project.configureExternalLinks() {
90
59
* - Template setup: https://github.com/JetBrains/kotlin-web-site/blob/master/.teamcity/builds/apiReferences/kotlinx/coroutines/KotlinxCoroutinesPrepareDokkaTemplates.kt
91
60
* - Templates repository: https://github.com/JetBrains/kotlin-web-site/tree/master/dokka-templates
92
61
*/
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
+ }
99
68
}
0 commit comments