aboutsummaryrefslogtreecommitdiff
path: root/runners/maven-plugin/src
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-31 08:26:57 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-14 17:51:11 +0200
commit5e50c7b9d5bc9da46365f43bd6f9346f91ad36f8 (patch)
tree76d20e3d74d471d87eaa0c060d6787861d8c4919 /runners/maven-plugin/src
parentaa21ab173d60bb69e50e7fc321e8b94c2815b6e8 (diff)
downloaddokka-5e50c7b9d5bc9da46365f43bd6f9346f91ad36f8.tar.gz
dokka-5e50c7b9d5bc9da46365f43bd6f9346f91ad36f8.tar.bz2
dokka-5e50c7b9d5bc9da46365f43bd6f9346f91ad36f8.zip
Replace ExternalDocumentationLink.Builder with factory functions
Diffstat (limited to 'runners/maven-plugin/src')
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt21
1 files changed, 11 insertions, 10 deletions
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
index d47f153e..ce68a671 100644
--- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
+++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
@@ -29,6 +29,7 @@ import org.eclipse.aether.transport.file.FileTransporterFactory
import org.eclipse.aether.transport.http.HttpTransporterFactory
import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator
import org.jetbrains.dokka.*
+import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink
import java.io.File
import java.net.URL
@@ -43,13 +44,15 @@ class SourceLinkMapItem {
var lineSuffix: String? = null
}
-class ExternalDocumentationLinkBuilder : DokkaConfiguration.ExternalDocumentationLink.Builder() {
+class ExternalDocumentationLinkBuilder {
@Parameter(name = "url", required = true)
- override var url: URL? = null
+ var url: URL? = null
@Parameter(name = "packageListUrl", required = true)
- override var packageListUrl: URL? = null
+ var packageListUrl: URL? = null
+
+ fun build() = ExternalDocumentationLink(url, packageListUrl)
}
abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependency>) : AbstractMojo() {
@@ -175,17 +178,14 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
throw MojoExecutionException("Incorrect path property, only Unix based path allowed.")
}
}
+
fun defaultLinks(config: DokkaSourceSetImpl): Set<ExternalDocumentationLinkImpl> {
val links = mutableSetOf<ExternalDocumentationLinkImpl>()
if (!config.noJdkLink)
- links += DokkaConfiguration.ExternalDocumentationLink
- .Builder("https://docs.oracle.com/javase/${config.jdkVersion}/docs/api/")
- .build()
+ links += ExternalDocumentationLink.jdk(jdkVersion)
if (!config.noStdlibLink)
- links += DokkaConfiguration.ExternalDocumentationLink
- .Builder("https://kotlinlang.org/api/latest/jvm/stdlib/")
- .build()
+ links += ExternalDocumentationLink.kotlinStdlib()
return links
}
@@ -236,7 +236,8 @@ abstract class AbstractDokkaMojo(private val defaultDokkaPlugins: List<Dependenc
if (sourceSet.moduleDisplayName.isEmpty()) logger.warn("Not specified module name. It can result in unexpected behaviour while including documentation for module")
},
pluginsClasspath = getArtifactByAether("org.jetbrains.dokka", "dokka-base", dokkaVersion) +
- dokkaPlugins.map { getArtifactByAether(it.groupId, it.artifactId, it.version ?: dokkaVersion) }.flatten(),
+ dokkaPlugins.map { getArtifactByAether(it.groupId, it.artifactId, it.version ?: dokkaVersion) }
+ .flatten(),
pluginsConfiguration = mutableMapOf(), //TODO implement as it is in Gradle
modules = emptyList(),
failOnWarning = failOnWarning