diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-01-08 14:22:25 +0100 |
---|---|---|
committer | Kamil Doległo <kamilok1965@interia.pl> | 2020-01-08 17:15:50 +0100 |
commit | d1585771c34263f9fb7d9e165ddf9cd349157143 (patch) | |
tree | 128a3dddf56ca329fa843431f5caf2e05ca7767e /runners | |
parent | 9e7154fef3394698dc52c52d61dd1aefde29251e (diff) | |
download | dokka-d1585771c34263f9fb7d9e165ddf9cd349157143.tar.gz dokka-d1585771c34263f9fb7d9e165ddf9cd349157143.tar.bz2 dokka-d1585771c34263f9fb7d9e165ddf9cd349157143.zip |
Fix linking to stdlib with Maven and CLI
Fixes https://github.com/Kotlin/dokka/issues/551 by adding default links in each runner. This should probably be done in one place later on, but I don't see a good place to do it. We can't add it in DokkaGenerator without copying the whole configuration to some default implementation and we can't do it in ExternalDocumentationLinkResolver without redoing it in PackageProvider
Diffstat (limited to 'runners')
-rw-r--r-- | runners/cli/src/main/kotlin/cli/main.kt | 6 | ||||
-rw-r--r-- | runners/maven-plugin/src/main/kotlin/DokkaMojo.kt | 3 |
2 files changed, 7 insertions, 2 deletions
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(), |