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