Fix dokka

This commit is contained in:
Him188 2021-01-12 18:57:42 +08:00
parent fe151a90fd
commit 7d3bcbeb1c
2 changed files with 23 additions and 24 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2019-2020 Mamoe Technologies and contributors. * Copyright 2019-2021 Mamoe Technologies and contributors.
* *
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * 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 {
plugins { plugins {
kotlin("jvm") version Versions.kotlinCompiler kotlin("jvm") version Versions.kotlinCompiler
kotlin("plugin.serialization") version Versions.kotlinCompiler kotlin("plugin.serialization") version Versions.kotlinCompiler
id("org.jetbrains.dokka") version Versions.dokka apply false id("org.jetbrains.dokka") version Versions.dokka
id("net.mamoe.kotlin-jvm-blocking-bridge") version Versions.blockingBridge apply false id("net.mamoe.kotlin-jvm-blocking-bridge") version Versions.blockingBridge apply false
id("com.jfrog.bintray") version Versions.bintray id("com.jfrog.bintray") version Versions.bintray
} }
@ -94,8 +94,12 @@ allprojects {
if (isKotlinJvmProject) { if (isKotlinJvmProject) {
configureFlattenSourceSets() configureFlattenSourceSets()
} }
}
}
configureDokka() subprojects {
afterEvaluate {
if (project.name == "mirai-core-api") configureDokka()
} }
} }
@ -108,34 +112,28 @@ fun Project.useIr() {
fun Project.configureDokka() { fun Project.configureDokka() {
apply(plugin = "org.jetbrains.dokka") apply(plugin = "org.jetbrains.dokka")
tasks { tasks {
val dokka by getting(DokkaTask::class) { val dokkaHtml by getting(DokkaTask::class) {
outputFormat = "html" outputDirectory.set(buildDir.resolve("dokka"))
outputDirectory = "$buildDir/dokka"
} }
val dokkaMarkdown by creating(DokkaTask::class) { val dokkaGfm by getting(DokkaTask::class) {
outputFormat = "markdown" outputDirectory.set(buildDir.resolve("dokka-gfm"))
outputDirectory = "$buildDir/dokka-markdown"
}
val dokkaGfm by creating(DokkaTask::class) {
outputFormat = "gfm"
outputDirectory = "$buildDir/dokka-gfm"
} }
} }
for (task in tasks.filterIsInstance<DokkaTask>()) { tasks.withType<DokkaTask>().configureEach {
task.configuration { dokkaSourceSets.configureEach {
perPackageOption { perPackageOption {
prefix = "net.mamoe.mirai" matchingRegex.set("net\\.mamoe\\.mirai\\.*")
skipDeprecated = true skipDeprecated.set(true)
} }
for (suppressedPackage in arrayOf( for (suppressedPackage in arrayOf(
"net.mamoe.mirai.internal", """net.mamoe.mirai.internal""",
"net.mamoe.mirai.event.internal", """net.mamoe.mirai.internal.message""",
"net.mamoe.mirai.utils.internal", """net.mamoe.mirai.internal.network"""
"net.mamoe.mirai.internal"
)) { )) {
perPackageOption { perPackageOption {
prefix = suppressedPackage matchingRegex.set(suppressedPackage.replace(".", "\\."))
suppress = true suppress.set(true)
} }
} }
} }

View File

@ -16,6 +16,8 @@ object Versions {
const val kotlinCompiler = "1.4.21" const val kotlinCompiler = "1.4.21"
const val kotlinStdlib = "1.4.21" const val kotlinStdlib = "1.4.21"
const val dokka = "1.4.20"
const val coroutines = "1.4.1" const val coroutines = "1.4.1"
const val atomicFU = "0.14.4" const val atomicFU = "0.14.4"
const val serialization = "1.0.1" const val serialization = "1.0.1"
@ -25,7 +27,6 @@ object Versions {
const val io = "0.1.16" const val io = "0.1.16"
const val coroutinesIo = "0.1.16" const val coroutinesIo = "0.1.16"
const val dokka = "0.10.1"
const val blockingBridge = "1.5.0" const val blockingBridge = "1.5.0"