Add Dokka task to the root project

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent 0c709bf0e6
commit 609576be63
  1. 42
      build.gradle.kts
  2. 1
      buildSrc/src/main/java/Versions.kt

@ -1,16 +1,23 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.ByteArrayOutputStream
import java.nio.charset.StandardCharsets
defaultTasks("build") defaultTasks("build")
plugins { plugins {
base base
id("com.github.ben-manes.versions") version Versions.versionsPlugin id("com.github.ben-manes.versions") version Versions.versionsPlugin
id("org.jetbrains.dokka") version Versions.dokka
kotlin("jvm") version Versions.kotlin
id("com.github.jk1.dependency-license-report") version Versions.dependencyLicenseReport apply false id("com.github.jk1.dependency-license-report") version Versions.dependencyLicenseReport apply false
id("com.github.johnrengelman.shadow") version Versions.shadowPlugin apply false id("com.github.johnrengelman.shadow") version Versions.shadowPlugin apply false
id("org.jmailen.kotlinter") version Versions.kotlinter apply false id("org.jmailen.kotlinter") version Versions.kotlinter apply false
kotlin("jvm") version Versions.kotlin apply false }
repositories {
jcenter()
} }
allprojects { allprojects {
@ -194,6 +201,39 @@ tasks.dependencyUpdates {
} }
} }
fun commitHash(): String {
val out = ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "HEAD")
standardOutput = out
}.assertNormalExitValue()
return String(out.toByteArray(), StandardCharsets.UTF_8).trim()
}
tasks.dokka {
outputDirectory = "${project.buildDir}/dokka"
outputFormat = "html"
subProjects = subprojects.filter { it.free && it.name != "deob-annotations" }.map { it.name }
configuration {
includeNonPublic = true
/*
* XXX(gpe): ideally we'd use 11 here, but we're blocked on
* https://github.com/Kotlin/dokka/issues/294. 9 is the most recent
* working version for now.
*/
jdkVersion = 9
sourceLink {
path = "."
url = "https://git.openrs2.dev/openrs2/openrs2/src/commit/${commitHash()}"
lineSuffix = "#L"
}
}
}
tasks.wrapper { tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL distributionType = Wrapper.DistributionType.ALL
} }

@ -4,6 +4,7 @@ object Versions {
const val clikt = "2.6.0" const val clikt = "2.6.0"
const val commonsCompress = "1.20" const val commonsCompress = "1.20"
const val dependencyLicenseReport = "1.13" const val dependencyLicenseReport = "1.13"
const val dokka = "0.10.1"
const val fastutil = "8.3.1" const val fastutil = "8.3.1"
const val fernflower = "1.0.4-SNAPSHOT" const val fernflower = "1.0.4-SNAPSHOT"
const val guava = "29.0-jre" const val guava = "29.0-jre"

Loading…
Cancel
Save