diff options
-rw-r--r-- | core/src/main/kotlin/Utilities/Links.kt | 18 | ||||
-rw-r--r-- | runners/cli/src/main/kotlin/cli/main.kt | 6 | ||||
-rw-r--r-- | runners/maven-plugin/src/main/kotlin/DokkaMojo.kt | 3 |
3 files changed, 25 insertions, 2 deletions
diff --git a/core/src/main/kotlin/Utilities/Links.kt b/core/src/main/kotlin/Utilities/Links.kt new file mode 100644 index 00000000..34423e4e --- /dev/null +++ b/core/src/main/kotlin/Utilities/Links.kt @@ -0,0 +1,18 @@ +package org.jetbrains.dokka.Utilities + +import org.jetbrains.dokka.DokkaConfiguration +import org.jetbrains.dokka.ExternalDocumentationLinkImpl + +fun DokkaConfiguration.PassConfiguration.defaultLinks(): List<ExternalDocumentationLinkImpl> { + val links = mutableListOf<ExternalDocumentationLinkImpl>() + if (!noJdkLink) + links += DokkaConfiguration.ExternalDocumentationLink + .Builder("https://docs.oracle.com/javase/${jdkVersion}/docs/api/") + .build() as ExternalDocumentationLinkImpl + + if (!noStdlibLink) + links += DokkaConfiguration.ExternalDocumentationLink + .Builder("https://kotlinlang.org/api/latest/jvm/stdlib/") + .build() as ExternalDocumentationLinkImpl + return links +} diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt index 52815e75..55601b21 100644 --- a/runners/cli/src/main/kotlin/cli/main.kt +++ b/runners/cli/src/main/kotlin/cli/main.kt @@ -1,6 +1,7 @@ package org.jetbrains.dokka import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink +import org.jetbrains.dokka.Utilities.defaultLinks import java.io.File import java.net.MalformedURLException import java.net.URL @@ -261,10 +262,11 @@ object MainKt { return configuration } + fun GlobalArguments.addDefaultLinks() = passesConfigurations.forEach { it.externalDocumentationLinks += it.defaultLinks() } + @JvmStatic fun main(args: Array<String>) { - val configuration = createConfiguration(args) - + val configuration = createConfiguration(args).apply { addDefaultLinks() } if (configuration.format.toLowerCase() == "javadoc") startWithToolsJar(configuration) else diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index fb11ecac..1cbe39f3 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -11,6 +11,7 @@ import org.apache.maven.project.MavenProjectHelper import org.codehaus.plexus.archiver.Archiver import org.codehaus.plexus.archiver.jar.JarArchiver import org.jetbrains.dokka.* +import org.jetbrains.dokka.Utilities.defaultLinks import java.io.File import java.net.URL @@ -183,6 +184,8 @@ abstract class AbstractDokkaMojo : AbstractMojo() { includeRootPackage = includeRootPackage ) + passConfiguration.externalDocumentationLinks += passConfiguration.defaultLinks() + val configuration = DokkaConfigurationImpl( outputDir = getOutDir(), format = getOutFormat(), |