diff options
author | Filip Zybała <fzybala@virtuslab.com> | 2020-03-25 13:16:10 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-03-31 13:05:43 +0200 |
commit | 0b3a58eb0ac6330b380e36147761b4dbe1c05281 (patch) | |
tree | d30f7c606cb0307d86b2489af6fe0569a527b241 /runners/cli/src | |
parent | ca2d5042c608951cd2f12ccc324543b59b7cc154 (diff) | |
download | dokka-0b3a58eb0ac6330b380e36147761b4dbe1c05281.tar.gz dokka-0b3a58eb0ac6330b380e36147761b4dbe1c05281.tar.bz2 dokka-0b3a58eb0ac6330b380e36147761b4dbe1c05281.zip |
Fixed maven and CLI runners stdlib links bug
Diffstat (limited to 'runners/cli/src')
-rw-r--r-- | runners/cli/src/main/kotlin/cli/main.kt | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt index 644ecee4..731b09d9 100644 --- a/runners/cli/src/main/kotlin/cli/main.kt +++ b/runners/cli/src/main/kotlin/cli/main.kt @@ -192,12 +192,27 @@ class Arguments(val parser: DokkaArgumentsParser) : DokkaConfiguration.PassConfi } object MainKt { + fun defaultLinks(config: DokkaConfiguration.PassConfiguration): List<ExternalDocumentationLink> { + val links = mutableListOf<ExternalDocumentationLinkImpl>() + if (!config.noJdkLink) + links += DokkaConfiguration.ExternalDocumentationLink + .Builder("https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/") + .build() as ExternalDocumentationLinkImpl + + if (!config.noStdlibLink) + links += DokkaConfiguration.ExternalDocumentationLink + .Builder("https://kotlinlang.org/api/latest/jvm/stdlib/") + .build() as ExternalDocumentationLinkImpl + return links + } + fun parseLinks(links: String): List<ExternalDocumentationLink> { val (parsedLinks, parsedOfflineLinks) = links.split("^^") .map { it.split("^").map { it.trim() }.filter { it.isNotBlank() } } .filter { it.isNotEmpty() } .partition { it.size == 1 } + return parsedLinks.map { (root) -> ExternalDocumentationLink.Builder(root).build() } + parsedOfflineLinks.map { (root, packageList) -> val rootUrl = URL(root) @@ -256,6 +271,7 @@ object MainKt { val parser = DokkaArgumentsParser(args, parseContext) val configuration = GlobalArguments(parser) + parseContext.cli.singleAction( listOf("-globalPackageOptions"), "List of package passConfiguration in format \"prefix,-deprecated,-privateApi,+warnUndocumented,+suppress;...\" " @@ -291,8 +307,10 @@ object MainKt { it.sourceLinks.toMutableList().addAll(newSourceLinks) } } - parser.parseInto(configuration) + configuration.passesConfigurations.forEach { + it.externalDocumentationLinks.addAll(defaultLinks(it)) + } return configuration } |