From 8cbf973f50d5a61707ec3987cd5684ceddc6bd32 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 30 Aug 2020 13:26:57 +0100 Subject: [PATCH] Update Dokka to 1.4.0-rc The output is significantly nicer. External documentation links don't seem to work correctly at the moment, so I have commented those out for now. Signed-off-by: Graham --- build.gradle.kts | 184 ++++++++++++++--------------- buildSrc/src/main/java/Versions.kt | 2 +- gradle.properties | 2 + 3 files changed, 92 insertions(+), 96 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f22830b0..c91d2aac 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,9 @@ +import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jmailen.gradle.kotlinter.KotlinterExtension import org.jmailen.gradle.kotlinter.KotlinterPlugin import java.io.ByteArrayOutputStream -import java.net.URL defaultTasks("build") @@ -28,6 +28,7 @@ allprojects { repositories { mavenCentral() + jcenter() maven(url = "https://repo.openrs2.dev/repository/openrs2") mavenLocal() maven(url = "https://repo.openrs2.dev/repository/openrs2-snapshots") @@ -113,6 +114,7 @@ configure(subprojects.filter { it.isFree }) { apply(plugin = "jacoco") plugins.withType { + apply(plugin = "org.jetbrains.dokka") apply(plugin = "org.jmailen.kotlinter") dependencies { @@ -130,6 +132,92 @@ configure(subprojects.filter { it.isFree }) { } } + tasks.withType { + inputs.dir("$rootDir/.git") + + dokkaSourceSets { + configureEach { + includeNonPublic = true + jdkVersion = 11 + moduleDisplayName = "openrs2" + + sourceLink { + path = rootDir.toString() + url = "https://git.openrs2.dev/openrs2/openrs2/src/commit/${commitHash()}" + lineSuffix = "#L" + } + + /*externalDocumentationLink { + url = URL("https://asm.ow2.io/javadoc/") + } + + externalDocumentationLink { + url = URL("https://www.bouncycastle.org/docs/docs1.5on/") + } + + externalDocumentationLink { + url = URL("https://www.bouncycastle.org/docs/pkixdocs1.5on/") + } + + externalDocumentationLink { + url = URL("https://ajalt.github.io/clikt/api/clikt/") + } + + externalDocumentationLink { + url = URL("https://commons.apache.org/proper/commons-compress/javadocs/api-${Versions.commonsCompress}/") + } + + externalDocumentationLink { + url = URL("https://guava.dev/releases/${Versions.guava}/api/docs/") + } + + externalDocumentationLink { + url = URL("https://google.github.io/guice/api-docs/${Versions.guice}/javadoc/") + } + + val jacksonVersion = Versions.jackson.split(".") + .take(2) + .joinToString(".") + + externalDocumentationLink { + url = URL("https://fasterxml.github.io/jackson-annotations/javadoc/$jacksonVersion/") + } + + externalDocumentationLink { + url = URL("https://fasterxml.github.io/jackson-core/javadoc/$jacksonVersion/") + } + + externalDocumentationLink { + url = URL("https://fasterxml.github.io/jackson-databind/javadoc/$jacksonVersion/") + } + + externalDocumentationLink { + url = URL("https://fasterxml.github.io/jackson-dataformats-text/javadoc/yaml/$jacksonVersion/") + } + + externalDocumentationLink { + url = URL("http://www.jdom.org/docs/apidocs/") + } + + externalDocumentationLink { + url = URL("https://google.github.io/jimfs/releases/${Versions.jimfs}/api/docs/") + } + + externalDocumentationLink { + url = URL("https://junit.org/junit5/docs/${Versions.junit}/api/") + } + + externalDocumentationLink { + val version = Versions.netty.split(".") + .take(2) + .joinToString(".") + + url = URL("https://netty.io/$version/api/") + }*/ + } + } + } + plugins.withType { dependencies { val testRuntimeOnly by configurations @@ -225,100 +313,6 @@ fun commitHash(): String { return String(out.toByteArray(), Charsets.UTF_8).trim() } -tasks.dokka { - inputs.dir("$rootDir/.git") - - outputDirectory = "$buildDir/kdoc" - outputFormat = "html" - - subProjects = subprojects.filter { it.isFree && 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" - } - - externalDocumentationLink { - url = URL("https://asm.ow2.io/javadoc/") - } - - externalDocumentationLink { - url = URL("https://www.bouncycastle.org/docs/docs1.5on/") - } - - externalDocumentationLink { - url = URL("https://www.bouncycastle.org/docs/pkixdocs1.5on/") - } - - externalDocumentationLink { - url = URL("https://ajalt.github.io/clikt/api/clikt/") - } - - externalDocumentationLink { - url = URL("https://commons.apache.org/proper/commons-compress/javadocs/api-${Versions.commonsCompress}/") - } - - externalDocumentationLink { - url = URL("https://guava.dev/releases/${Versions.guava}/api/docs/") - } - - externalDocumentationLink { - url = URL("https://google.github.io/guice/api-docs/${Versions.guice}/javadoc/") - } - - val jacksonVersion = Versions.jackson.split(".") - .take(2) - .joinToString(".") - - externalDocumentationLink { - url = URL("https://fasterxml.github.io/jackson-annotations/javadoc/$jacksonVersion/") - } - - externalDocumentationLink { - url = URL("https://fasterxml.github.io/jackson-core/javadoc/$jacksonVersion/") - } - - externalDocumentationLink { - url = URL("https://fasterxml.github.io/jackson-databind/javadoc/$jacksonVersion/") - } - - externalDocumentationLink { - url = URL("https://fasterxml.github.io/jackson-dataformats-text/javadoc/yaml/$jacksonVersion/") - } - - externalDocumentationLink { - url = URL("http://www.jdom.org/docs/apidocs/") - } - - externalDocumentationLink { - url = URL("https://google.github.io/jimfs/releases/${Versions.jimfs}/api/docs/") - } - - externalDocumentationLink { - url = URL("https://junit.org/junit5/docs/${Versions.junit}/api/") - } - - externalDocumentationLink { - val version = Versions.netty.split(".") - .take(2) - .joinToString(".") - - url = URL("https://netty.io/$version/api/") - } - } -} - tasks.wrapper { distributionType = Wrapper.DistributionType.ALL } diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index 383752a7..41d37b95 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -5,7 +5,7 @@ object Versions { const val clikt = "2.8.0" const val commonsCompress = "1.20" const val dependencyLicenseReport = "1.14" - const val dokka = "0.10.1" + const val dokka = "1.4.0-rc" const val fastutil = "8.4.1" const val fernflower = "1.0.4-SNAPSHOT" const val guava = "29.0-jre" diff --git a/gradle.properties b/gradle.properties index 7fc6f1ff..8dfde457 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,3 @@ kotlin.code.style=official +# see https://github.com/Kotlin/dokka/issues/1405 +org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m