diff --git a/build.gradle.kts b/build.gradle.kts index 6b107bf47..ed46cbb93 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 许可证的约束, 可以在以下链接找到该许可证. * 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 { kotlin("jvm") 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("com.jfrog.bintray") version Versions.bintray } @@ -94,8 +94,12 @@ allprojects { if (isKotlinJvmProject) { configureFlattenSourceSets() } + } +} - configureDokka() +subprojects { + afterEvaluate { + if (project.name == "mirai-core-api") configureDokka() } } @@ -108,34 +112,28 @@ fun Project.useIr() { fun Project.configureDokka() { apply(plugin = "org.jetbrains.dokka") tasks { - val dokka by getting(DokkaTask::class) { - outputFormat = "html" - outputDirectory = "$buildDir/dokka" + val dokkaHtml by getting(DokkaTask::class) { + outputDirectory.set(buildDir.resolve("dokka")) } - val dokkaMarkdown by creating(DokkaTask::class) { - outputFormat = "markdown" - outputDirectory = "$buildDir/dokka-markdown" - } - val dokkaGfm by creating(DokkaTask::class) { - outputFormat = "gfm" - outputDirectory = "$buildDir/dokka-gfm" + val dokkaGfm by getting(DokkaTask::class) { + outputDirectory.set(buildDir.resolve("dokka-gfm")) } } - for (task in tasks.filterIsInstance()) { - task.configuration { + tasks.withType().configureEach { + dokkaSourceSets.configureEach { perPackageOption { - prefix = "net.mamoe.mirai" - skipDeprecated = true + matchingRegex.set("net\\.mamoe\\.mirai\\.*") + skipDeprecated.set(true) } + for (suppressedPackage in arrayOf( - "net.mamoe.mirai.internal", - "net.mamoe.mirai.event.internal", - "net.mamoe.mirai.utils.internal", - "net.mamoe.mirai.internal" + """net.mamoe.mirai.internal""", + """net.mamoe.mirai.internal.message""", + """net.mamoe.mirai.internal.network""" )) { perPackageOption { - prefix = suppressedPackage - suppress = true + matchingRegex.set(suppressedPackage.replace(".", "\\.")) + suppress.set(true) } } } diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 175ada9ac..a19b5269d 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -16,6 +16,8 @@ object Versions { const val kotlinCompiler = "1.4.21" const val kotlinStdlib = "1.4.21" + const val dokka = "1.4.20" + const val coroutines = "1.4.1" const val atomicFU = "0.14.4" const val serialization = "1.0.1" @@ -25,7 +27,6 @@ object Versions { const val io = "0.1.16" const val coroutinesIo = "0.1.16" - const val dokka = "0.10.1" const val blockingBridge = "1.5.0"