aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
Diffstat (limited to 'runners')
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt27
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleExternalDocumentationLinkBuilder.kt5
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt23
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt21
6 files changed, 29 insertions, 51 deletions
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index 43c46d92..4b0bd04e 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -299,26 +299,17 @@ object ArgTypeHelpSourceSet : ArgType<Any>(false) {
get() = ""
}
+@OptIn(ExperimentalStdlibApi::class)
fun defaultLinks(config: DokkaConfiguration.DokkaSourceSet): MutableList<ExternalDocumentationLink> =
- mutableListOf<ExternalDocumentationLink>().apply {
+ buildList<ExternalDocumentationLink> {
if (!config.noJdkLink) {
- // TODO NOW: Duplication
- 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 += ExternalDocumentationLink
- .Builder(javadocLink, packageListLink)
- .build()
+ add(ExternalDocumentationLink.jdk(config.jdkVersion))
}
- if (!config.noStdlibLink)
- this += ExternalDocumentationLink
- .Builder("https://kotlinlang.org/api/latest/jvm/stdlib/")
- .build()
- }
+ if (!config.noStdlibLink) {
+ add(ExternalDocumentationLink.kotlinStdlib())
+ }
+ }.toMutableList()
fun parseLinks(links: List<String>): List<ExternalDocumentationLink> {
@@ -327,7 +318,7 @@ fun parseLinks(links: List<String>): List<ExternalDocumentationLink> {
.filter { it.isNotEmpty() }
.partition { it.size == 1 }
- return parsedLinks.map { (root) -> ExternalDocumentationLink.Builder(root).build() } +
+ return parsedLinks.map { (root) -> ExternalDocumentationLink(root) } +
parsedOfflineLinks.map { (root, packageList) ->
val rootUrl = URL(root)
val packageListUrl =
@@ -336,7 +327,7 @@ fun parseLinks(links: List<String>): List<ExternalDocumentationLink> {
} catch (ex: MalformedURLException) {
File(packageList).toURI().toURL()
}
- ExternalDocumentationLink.Builder(rootUrl, packageListUrl).build()
+ ExternalDocumentationLink(rootUrl, packageListUrl)
}
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleExternalDocumentationLinkBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleExternalDocumentationLinkBuilder.kt
index 2960ba23..23017917 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleExternalDocumentationLinkBuilder.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleExternalDocumentationLinkBuilder.kt
@@ -10,9 +10,8 @@ import org.jetbrains.dokka.ExternalDocumentationLinkImpl
import java.net.URL
class GradleExternalDocumentationLinkBuilder(
- @get:Internal internal val project: Project
-) :
- DokkaConfigurationBuilder<ExternalDocumentationLinkImpl> {
+ @Transient @get:Internal internal val project: Project
+) : DokkaConfigurationBuilder<ExternalDocumentationLinkImpl> {
@Input
val url: Property<URL?> = project.objects.safeProperty()
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt
index 854dc9a0..ba66ad45 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradlePackageOptionsBuilder.kt
@@ -12,7 +12,7 @@ import org.jetbrains.dokka.PackageOptionsImpl
class GradlePackageOptionsBuilder(
- @get:Internal internal val project: Project
+ @Transient @get:Internal internal val project: Project
) : DokkaConfigurationBuilder<PackageOptionsImpl> {
@Input
val prefix: Property<String> = project.objects.safeProperty<String>()
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt
index 2cd85c26..54700fe9 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/GradleSourceLinkBuilder.kt
@@ -9,7 +9,7 @@ import org.jetbrains.dokka.DokkaConfigurationBuilder
import org.jetbrains.dokka.SourceLinkDefinitionImpl
class GradleSourceLinkBuilder(
- @get:Internal internal val project: Project
+ @Transient @get:Internal internal val project: Project
) : DokkaConfigurationBuilder<SourceLinkDefinitionImpl> {
@Input
val path: Property<String> = project.objects.safeProperty<String>()
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt
index 5ed0d17f..766f7e55 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/toDokkaSourceSetImpl.kt
@@ -1,6 +1,7 @@
package org.jetbrains.dokka.gradle
import org.jetbrains.dokka.*
+import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink
import java.io.File
import java.net.URL
@@ -44,31 +45,17 @@ private fun GradleDokkaSourceSetBuilder.externalDocumentationLinksWithDefaults()
return externalDocumentationLinks.getSafe().build()
.run {
if (noJdkLink.get()) this
- else this + ExternalDocumentationLink(
- url =
- if (jdkVersion.getSafe() < 11) "https://docs.oracle.com/javase/" +
- "${jdkVersion.getSafe()}/docs/api/"
- else "https://docs.oracle.com/en/java/javase/" +
- "${jdkVersion.getSafe()}/docs/api/java.base/",
- packageListUrl =
- if (jdkVersion.getSafe() < 11) "https://docs.oracle.com/javase/" +
- "${jdkVersion.getSafe()}/docs/api/package-list"
- else "https://docs.oracle.com/en/java/javase/" +
- "${jdkVersion.getSafe()}/docs/api/element-list"
- )
+ else this + ExternalDocumentationLink.jdk(jdkVersion.getSafe())
}
.run {
if (noStdlibLink.getSafe()) this
- else this + ExternalDocumentationLink("https://kotlinlang.org/api/latest/jvm/stdlib/")
+ else this + ExternalDocumentationLink.kotlinStdlib()
}
.run {
if (noAndroidSdkLink.getSafe() || !project.isAndroidProject()) this
else this +
- ExternalDocumentationLink("https://developer.android.com/reference/") +
- ExternalDocumentationLink(
- url = URL("https://developer.android.com/reference/kotlin/"),
- packageListUrl = URL("https://developer.android.com/reference/androidx/package-list")
- )
+ ExternalDocumentationLink.androidSdk() +
+ ExternalDocumentationLink.androidX()
}
.toSet()
}
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