mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-04 15:40:13 +08:00
Update dokka task, prefer HTML format than GFM, for #333
This commit is contained in:
parent
63d5600672
commit
7565f5f1f1
@ -1,5 +1,6 @@
|
||||
@file:Suppress("UnstableApiUsage", "UNUSED_VARIABLE")
|
||||
|
||||
import org.jetbrains.dokka.gradle.DokkaTask
|
||||
import java.time.Duration
|
||||
import kotlin.math.pow
|
||||
|
||||
@ -120,15 +121,15 @@ subprojects {
|
||||
|
||||
apply(plugin = "org.jetbrains.dokka")
|
||||
this.tasks {
|
||||
val dokka by getting(org.jetbrains.dokka.gradle.DokkaTask::class) {
|
||||
val dokka by getting(DokkaTask::class) {
|
||||
outputFormat = "html"
|
||||
outputDirectory = "$buildDir/dokka"
|
||||
}
|
||||
val dokkaMarkdown by creating(org.jetbrains.dokka.gradle.DokkaTask::class) {
|
||||
val dokkaMarkdown by creating(DokkaTask::class) {
|
||||
outputFormat = "markdown"
|
||||
outputDirectory = "$buildDir/dokka-markdown"
|
||||
}
|
||||
val dokkaGfm by creating(org.jetbrains.dokka.gradle.DokkaTask::class) {
|
||||
val dokkaGfm by creating(DokkaTask::class) {
|
||||
outputFormat = "gfm"
|
||||
outputDirectory = "$buildDir/dokka-gfm"
|
||||
}
|
||||
@ -137,17 +138,20 @@ subprojects {
|
||||
val dokkaGitHubUpload by tasks.creating {
|
||||
group = "mirai"
|
||||
|
||||
dependsOn(tasks.getByName("dokkaGfm"))
|
||||
val dokkaTaskName = "dokka"
|
||||
|
||||
dependsOn(tasks.getByName(dokkaTaskName))
|
||||
doFirst {
|
||||
val baseDir = file("./build/dokka-gfm/${project.name}")
|
||||
val baseDir = file("./build/$dokkaTaskName/${project.name}")
|
||||
|
||||
timeout.set(Duration.ofHours(6))
|
||||
file("build/dokka-gfm/").walk()
|
||||
file("build/$dokkaTaskName/").walk()
|
||||
.filter { it.isFile }
|
||||
.map { old ->
|
||||
if (old.name == "index.md") File(old.parentFile, "README.md").also { new -> old.renameTo(new) }
|
||||
else old
|
||||
}
|
||||
// optimize md
|
||||
.forEach { file ->
|
||||
if (file.endsWith(".md")) {
|
||||
file.writeText(
|
||||
@ -212,7 +216,7 @@ subprojects {
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
tasks.filterIsInstance<org.jetbrains.dokka.gradle.DokkaTask>().forEach { task ->
|
||||
tasks.filterIsInstance<DokkaTask>().forEach { task ->
|
||||
with(task) {
|
||||
configuration {
|
||||
perPackageOption {
|
||||
|
Loading…
Reference in New Issue
Block a user