From 28b45f5f230f2b551218a0efd8a6c266f10f2534 Mon Sep 17 00:00:00 2001 From: Błażej Kardyś Date: Mon, 27 Jul 2020 01:50:52 +0200 Subject: Correct newer javadoc links --- core/src/main/kotlin/DokkaBootstrapImpl.kt | 11 +++++++++-- runners/cli/src/main/kotlin/cli/main.kt | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt index fabbc889..a2efab41 100644 --- a/core/src/main/kotlin/DokkaBootstrapImpl.kt +++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt @@ -74,10 +74,17 @@ class DokkaBootstrapImpl : DokkaBootstrap { fun defaultLinks(config: DokkaSourceSetImpl): List { val links = mutableListOf() - if (!config.noJdkLink) + if (!config.noJdkLink) { + val javadocLink = + if (config.jdkVersion < 11) "https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/" + else "https://docs.oracle.com/en/java/javase/${config.jdkVersion}/docs/api/java.base/" + val packageListLink = + if (config.jdkVersion < 11) "${javadocLink}/package-list" + else "https://docs.oracle.com/en/java/javase/${config.jdkVersion}/docs/api/element-list" links += DokkaConfiguration.ExternalDocumentationLink - .Builder("https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/") + .Builder(javadocLink, packageListLink) .build() as ExternalDocumentationLinkImpl + } if (!config.noStdlibLink) links += DokkaConfiguration.ExternalDocumentationLink diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt index 30b8d92d..f8d5c55c 100644 --- a/runners/cli/src/main/kotlin/cli/main.kt +++ b/runners/cli/src/main/kotlin/cli/main.kt @@ -306,10 +306,17 @@ object ArgTypeHelpSourceSet : ArgType(false) { fun defaultLinks(config: DokkaConfiguration.DokkaSourceSet): MutableList = mutableListOf().apply { - if (!config.noJdkLink) + if (!config.noJdkLink) { + val javadocLink = + if (config.jdkVersion < 11) "https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/" + else "https://docs.oracle.com/en/java/javase/${config.jdkVersion}/docs/api/java.base/" + val packageListLink = + if (config.jdkVersion < 11) "${javadocLink}/package-list" + else "https://docs.oracle.com/en/java/javase/${config.jdkVersion}/docs/api/element-list" this += DokkaConfiguration.ExternalDocumentationLink - .Builder("https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/") + .Builder(javadocLink, packageListLink) .build() + } if (!config.noStdlibLink) this += ExternalDocumentationLink -- cgit