forked from Hexworks/zircon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
68 lines (57 loc) · 2.16 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
plugins {
id("org.jetbrains.dokka")
id("org.sonarqube") version "3.3"
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
maven("https://dl.bintray.com/kotlin/kotlinx")
}
}
sonarqube {
properties {
property("sonar.projectKey", "Hexworks_zircon")
property("sonar.organization", "hexworks")
property("sonar.host.url", "https://sonarcloud.io")
}
}
tasks {
val docsDir = projectDir.resolve("docs")
val renameModulesToIndex by registering {
doLast {
logger.lifecycle("---=== Renaming -modules.html to index.html ===---")
docsDir.listFiles()
?.filter { it.isDirectory }
?.forEach { dir ->
dir.listFiles()
?.find { file -> file.name == "-modules.html" }
?.renameTo(File(dir, "index.html"))
}
}
}
val generateDocsIndexTask by registering {
doLast {
logger.lifecycle("---=== Generating index.html for docs ===---")
val docsSubDirs = docsDir.listFiles()
?.filter { it.isDirectory }
?.joinToString("\n") { dir -> "<li><a href=\"${dir.name}\">${dir.name}</a></li>" }
val html = """|<!doctype html><head><title>Choose a Version</title></head><body>
|<h1>Pick a Version</h1><ul>
|$docsSubDirs
|</ul></body></html>""".trimMargin()
docsDir.resolve("index.html").writeText(html)
}
}
dokkaHtmlMultiModule {
outputDirectory.set(docsDir.resolve(project.version.toString() + "-KOTLIN"))
finalizedBy(renameModulesToIndex, generateDocsIndexTask)
}
register<DokkaMultiModuleTask>("dokkaHtmlAsJavaMultiModule") {
addSubprojectChildTasks("dokkaHtmlAsJava")
removeChildTask(":zircon.core:dokkaHtmlAsJava") // TODO: remove after /~https://github.com/Kotlin/dokka/issues/1663 is fixed
outputDirectory.set(docsDir.resolve("${project.version}-JAVA"))
finalizedBy(renameModulesToIndex, generateDocsIndexTask)
}
}