Skip to content

Commit 7d3bcbe

Browse files
committed
Fix dokka
1 parent fe151a9 commit 7d3bcbe

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

build.gradle.kts

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2020 Mamoe Technologies and contributors.
2+
* Copyright 2019-2021 Mamoe Technologies and contributors.
33
*
44
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
55
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
@@ -38,7 +38,7 @@ buildscript {
3838
plugins {
3939
kotlin("jvm") version Versions.kotlinCompiler
4040
kotlin("plugin.serialization") version Versions.kotlinCompiler
41-
id("org.jetbrains.dokka") version Versions.dokka apply false
41+
id("org.jetbrains.dokka") version Versions.dokka
4242
id("net.mamoe.kotlin-jvm-blocking-bridge") version Versions.blockingBridge apply false
4343
id("com.jfrog.bintray") version Versions.bintray
4444
}
@@ -94,8 +94,12 @@ allprojects {
9494
if (isKotlinJvmProject) {
9595
configureFlattenSourceSets()
9696
}
97+
}
98+
}
9799

98-
configureDokka()
100+
subprojects {
101+
afterEvaluate {
102+
if (project.name == "mirai-core-api") configureDokka()
99103
}
100104
}
101105

@@ -108,34 +112,28 @@ fun Project.useIr() {
108112
fun Project.configureDokka() {
109113
apply(plugin = "org.jetbrains.dokka")
110114
tasks {
111-
val dokka by getting(DokkaTask::class) {
112-
outputFormat = "html"
113-
outputDirectory = "$buildDir/dokka"
115+
val dokkaHtml by getting(DokkaTask::class) {
116+
outputDirectory.set(buildDir.resolve("dokka"))
114117
}
115-
val dokkaMarkdown by creating(DokkaTask::class) {
116-
outputFormat = "markdown"
117-
outputDirectory = "$buildDir/dokka-markdown"
118-
}
119-
val dokkaGfm by creating(DokkaTask::class) {
120-
outputFormat = "gfm"
121-
outputDirectory = "$buildDir/dokka-gfm"
118+
val dokkaGfm by getting(DokkaTask::class) {
119+
outputDirectory.set(buildDir.resolve("dokka-gfm"))
122120
}
123121
}
124-
for (task in tasks.filterIsInstance<DokkaTask>()) {
125-
task.configuration {
122+
tasks.withType<DokkaTask>().configureEach {
123+
dokkaSourceSets.configureEach {
126124
perPackageOption {
127-
prefix = "net.mamoe.mirai"
128-
skipDeprecated = true
125+
matchingRegex.set("net\\.mamoe\\.mirai\\.*")
126+
skipDeprecated.set(true)
129127
}
128+
130129
for (suppressedPackage in arrayOf(
131-
"net.mamoe.mirai.internal",
132-
"net.mamoe.mirai.event.internal",
133-
"net.mamoe.mirai.utils.internal",
134-
"net.mamoe.mirai.internal"
130+
"""net.mamoe.mirai.internal""",
131+
"""net.mamoe.mirai.internal.message""",
132+
"""net.mamoe.mirai.internal.network"""
135133
)) {
136134
perPackageOption {
137-
prefix = suppressedPackage
138-
suppress = true
135+
matchingRegex.set(suppressedPackage.replace(".", "\\."))
136+
suppress.set(true)
139137
}
140138
}
141139
}

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ object Versions {
1616

1717
const val kotlinCompiler = "1.4.21"
1818
const val kotlinStdlib = "1.4.21"
19+
const val dokka = "1.4.20"
20+
1921
const val coroutines = "1.4.1"
2022
const val atomicFU = "0.14.4"
2123
const val serialization = "1.0.1"
@@ -25,7 +27,6 @@ object Versions {
2527

2628
const val io = "0.1.16"
2729
const val coroutinesIo = "0.1.16"
28-
const val dokka = "0.10.1"
2930

3031
const val blockingBridge = "1.5.0"
3132

0 commit comments

Comments
 (0)