aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
Diffstat (limited to 'runners')
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt24
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt22
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt98
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt2
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt9
6 files changed, 93 insertions, 64 deletions
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index 80971ae2..37c13442 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -3,7 +3,7 @@ package org.jetbrains.dokka
import com.google.gson.Gson
import kotlinx.cli.*
import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink
-import org.jetbrains.dokka.DokkaConfiguration.PassConfiguration.*
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet.*
import org.jetbrains.dokka.utilities.DokkaConsoleLogger
import org.jetbrains.dokka.utilities.cast
import java.io.*
@@ -31,9 +31,9 @@ class GlobalArguments(args: Array<String>) : DokkaConfiguration {
description = "Path to cache folder, or 'default' to use ~/.cache/dokka, if not provided caching is disabled"
)
- override val passesConfigurations by parser.option(
+ override val sourceSets by parser.option(
ArgTypeArgument,
- description = "Single dokka pass",
+ description = "Single dokka source set",
fullName = "pass"
).multiple()
@@ -83,18 +83,18 @@ class GlobalArguments(args: Array<String>) : DokkaConfiguration {
init {
parser.parse(args)
- passesConfigurations.all {
+ sourceSets.all {
it.perPackageOptions.cast<MutableList<DokkaConfiguration.PackageOptions>>()
.addAll(parsePerPackageOptions(globalPackageOptions))
}
- passesConfigurations.all {
+ sourceSets.all {
it.externalDocumentationLinks.cast<MutableList<ExternalDocumentationLink>>().addAll(parseLinks(globalLinks))
}
globalSrcLink.forEach {
if (it.isNotEmpty() && it.contains("="))
- passesConfigurations.all { pass ->
+ sourceSets.all { pass ->
pass.sourceLinks.cast<MutableList<SourceLinkDefinitionImpl>>()
.add(SourceLinkDefinitionImpl.parseSourceLinkDefinition(it))
}
@@ -103,13 +103,13 @@ class GlobalArguments(args: Array<String>) : DokkaConfiguration {
}
}
- passesConfigurations.forEach {
+ sourceSets.forEach {
it.externalDocumentationLinks.cast<MutableList<ExternalDocumentationLink>>().addAll(defaultLinks(it))
}
}
}
-fun passArguments(args: Array<String>): DokkaConfiguration.PassConfiguration {
+fun passArguments(args: Array<String>): DokkaConfiguration.DokkaSourceSet {
val parser = ArgParser("passConfiguration", prefixStyle = ArgParser.OptionPrefixStyle.JVM)
@@ -226,7 +226,7 @@ fun passArguments(args: Array<String>): DokkaConfiguration.PassConfiguration {
parser.parse(args)
- return object : DokkaConfiguration.PassConfiguration {
+ return object : DokkaConfiguration.DokkaSourceSet {
override val moduleName = moduleName
override val displayName = displayName
override val sourceSetID = sourceSetID
@@ -289,8 +289,8 @@ object ArgTypeSourceLinkDefinition : ArgType<DokkaConfiguration.SourceLinkDefini
get() = "{ String that represent source links }"
}
-object ArgTypeArgument : ArgType<DokkaConfiguration.PassConfiguration>(true) {
- override fun convert(value: kotlin.String, name: kotlin.String): DokkaConfiguration.PassConfiguration =
+object ArgTypeArgument : ArgType<DokkaConfiguration.DokkaSourceSet>(true) {
+ override fun convert(value: kotlin.String, name: kotlin.String): DokkaConfiguration.DokkaSourceSet =
passArguments(value.split(" ").filter { it.isNotBlank() }.toTypedArray())
override val description: kotlin.String
@@ -305,7 +305,7 @@ object ArgTypeHelpPass : ArgType<Any>(false) {
get() = ""
}
-fun defaultLinks(config: DokkaConfiguration.PassConfiguration): MutableList<ExternalDocumentationLink> =
+fun defaultLinks(config: DokkaConfiguration.DokkaSourceSet): MutableList<ExternalDocumentationLink> =
mutableListOf<ExternalDocumentationLink>().apply {
if (!config.noJdkLink)
this += DokkaConfiguration.ExternalDocumentationLink
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
index cef3695a..8483cd60 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
@@ -38,7 +38,7 @@ open class DokkaCollectorTask : DefaultTask() {
configuration = passesConfigurations.fold(initial) { acc, it: GradleDokkaConfigurationImpl ->
if(acc.format != it.format || acc.cacheRoot != it.cacheRoot)
throw IllegalStateException("Dokka task configurations differ on core arguments (format, cacheRoot)")
- acc.passesConfigurations = acc.passesConfigurations + it.passesConfigurations
+ acc.sourceSets = acc.sourceSets + it.sourceSets
acc.pluginsClasspath = (acc.pluginsClasspath + it.pluginsClasspath).distinct()
acc
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
index 1759b6f3..cc9471a1 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt
@@ -69,9 +69,9 @@ open class DokkaTask : DefaultTask(), Configurable {
internal var config: GradleDokkaConfigurationImpl? = null
- var dokkaSourceSets: NamedDomainObjectContainer<GradlePassConfigurationImpl>
+ var dokkaSourceSets: NamedDomainObjectContainer<GradleDokkaSourceSet>
@Suppress("UNCHECKED_CAST")
- @Nested get() = (DslObject(this).extensions.getByName(SOURCE_SETS_EXTENSION_NAME) as NamedDomainObjectContainer<GradlePassConfigurationImpl>)
+ @Nested get() = (DslObject(this).extensions.getByName(SOURCE_SETS_EXTENSION_NAME) as NamedDomainObjectContainer<GradleDokkaSourceSet>)
internal set(value) = DslObject(this).extensions.add(SOURCE_SETS_EXTENSION_NAME, value)
private val kotlinTasks: List<Task> by lazy {
@@ -184,7 +184,7 @@ open class DokkaTask : DefaultTask(), Configurable {
.map { defaultPassConfiguration(it, globalConfig) }.takeIf { it.isNotEmpty() }
?: listOf(
defaultPassConfiguration(
- collectSinglePassConfiguration(GradlePassConfigurationImpl("main")),
+ collectSinglePassConfiguration(GradleDokkaSourceSet("main")),
null
)
).takeIf { project.isNotMultiplatformProject() } ?: emptyList()
@@ -199,7 +199,7 @@ open class DokkaTask : DefaultTask(), Configurable {
format = outputFormat
cacheRoot = this@DokkaTask.cacheRoot
offlineMode = this@DokkaTask.offlineMode
- passesConfigurations = defaultModulesConfiguration
+ sourceSets = passConfigurations
pluginsClasspath = pluginsClasspathConfiguration.resolve().toList()
pluginsConfiguration = this@DokkaTask.pluginsConfiguration
failOnWarning = this@DokkaTask.failOnWarning
@@ -207,12 +207,12 @@ open class DokkaTask : DefaultTask(), Configurable {
}
- protected val passConfigurations: List<GradlePassConfigurationImpl>
+ protected val passConfigurations: List<GradleDokkaSourceSet>
get() = dokkaSourceSets
.filterNot { it.name.toLowerCase() == GLOBAL_CONFIGURATION_NAME }
.map { collectSinglePassConfiguration(it) }
- protected fun collectSinglePassConfiguration(config: GradlePassConfigurationImpl): GradlePassConfigurationImpl {
+ protected fun collectSinglePassConfiguration(config: GradleDokkaSourceSet): GradleDokkaSourceSet {
val userConfig = config
.apply {
collectKotlinTasks?.let {
@@ -259,7 +259,7 @@ open class DokkaTask : DefaultTask(), Configurable {
}
}
- protected fun collectFromSinglePlatformOldPlugin(name: String, userConfig: GradlePassConfigurationImpl) =
+ protected fun collectFromSinglePlatformOldPlugin(name: String, userConfig: GradleDokkaSourceSet) =
kotlinTasks.find { it.name == name }
?.let { configExtractor.extractFromKotlinTasks(listOf(it)) }
?.singleOrNull()
@@ -269,7 +269,7 @@ open class DokkaTask : DefaultTask(), Configurable {
?: userConfig
protected fun mergeUserConfigurationAndPlatformData(
- userConfig: GradlePassConfigurationImpl,
+ userConfig: GradleDokkaSourceSet,
autoConfig: PlatformData
) =
userConfig.copy().apply {
@@ -281,9 +281,9 @@ open class DokkaTask : DefaultTask(), Configurable {
}
protected fun defaultPassConfiguration(
- config: GradlePassConfigurationImpl,
- globalConfig: GradlePassConfigurationImpl?
- ): GradlePassConfigurationImpl {
+ config: GradleDokkaSourceSet,
+ globalConfig: GradleDokkaSourceSet?
+ ): GradleDokkaSourceSet {
if (config.moduleName.isBlank()) {
config.moduleName = project.name
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
index f4e7730e..c5169ef8 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/configurationImplementations.kt
@@ -16,7 +16,7 @@ import java.util.concurrent.Callable
import kotlin.reflect.KMutableProperty
import kotlin.reflect.full.memberProperties
-class GradleSourceRootImpl: SourceRoot, Serializable {
+class GradleSourceRootImpl : SourceRoot, Serializable {
override var path: String = ""
set(value) {
field = File(value).absolutePath
@@ -25,33 +25,63 @@ class GradleSourceRootImpl: SourceRoot, Serializable {
override fun toString(): String = path
}
-open class GradlePassConfigurationImpl(@Transient val name: String = ""): PassConfiguration {
- @Input @Optional override var classpath: List<String> = emptyList()
- @Input override var moduleName: String = ""
- @Input override var displayName: String = ""
- @Input override var sourceSetID: String = ""
- @Input override var sourceRoots: MutableList<SourceRoot> = mutableListOf()
- @Input override var dependentSourceSets: MutableList<String> = mutableListOf()
- @Input override var samples: List<String> = emptyList()
- @Input override var includes: List<String> = emptyList()
- @Input override var includeNonPublic: Boolean = DokkaDefaults.includeNonPublic
- @Input override var includeRootPackage: Boolean = DokkaDefaults.includeRootPackage
- @Input override var reportUndocumented: Boolean = DokkaDefaults.reportUndocumented
- @Input override var skipEmptyPackages: Boolean = DokkaDefaults.skipEmptyPackages
- @Input override var skipDeprecated: Boolean = DokkaDefaults.skipDeprecated
- @Input override var jdkVersion: Int = DokkaDefaults.jdkVersion
- @Input override var sourceLinks: MutableList<SourceLinkDefinition> = mutableListOf()
- @Input override var perPackageOptions: MutableList<PackageOptions> = mutableListOf()
- @Input override var externalDocumentationLinks: MutableList<ExternalDocumentationLink> = mutableListOf()
- @Input @Optional override var languageVersion: String? = null
- @Input @Optional override var apiVersion: String? = null
- @Input override var noStdlibLink: Boolean = DokkaDefaults.noStdlibLink
- @Input override var noJdkLink: Boolean = DokkaDefaults.noJdkLink
- @Input var noAndroidSdkLink: Boolean = false
- @Input override var suppressedFiles: List<String> = emptyList()
- @Input override var analysisPlatform: Platform = DokkaDefaults.analysisPlatform
- @Input @Optional var platform: String? = null
- @Transient var collectKotlinTasks: (() -> List<Any?>?)? = null
+open class GradleDokkaSourceSet(@Transient val name: String = "") : DokkaSourceSet {
+ @Input
+ @Optional
+ override var classpath: List<String> = emptyList()
+ @Input
+ override var moduleName: String = ""
+ @Input
+ override var displayName: String = ""
+ @Input
+ override var sourceSetID: String = ""
+ @Input
+ override var sourceRoots: MutableList<SourceRoot> = mutableListOf()
+ @Input
+ override var dependentSourceSets: MutableList<String> = mutableListOf()
+ @Input
+ override var samples: List<String> = emptyList()
+ @Input
+ override var includes: List<String> = emptyList()
+ @Input
+ override var includeNonPublic: Boolean = DokkaDefaults.includeNonPublic
+ @Input
+ override var includeRootPackage: Boolean = DokkaDefaults.includeRootPackage
+ @Input
+ override var reportUndocumented: Boolean = DokkaDefaults.reportUndocumented
+ @Input
+ override var skipEmptyPackages: Boolean = DokkaDefaults.skipEmptyPackages
+ @Input
+ override var skipDeprecated: Boolean = DokkaDefaults.skipDeprecated
+ @Input
+ override var jdkVersion: Int = DokkaDefaults.jdkVersion
+ @Input
+ override var sourceLinks: MutableList<SourceLinkDefinition> = mutableListOf()
+ @Input
+ override var perPackageOptions: MutableList<PackageOptions> = mutableListOf()
+ @Input
+ override var externalDocumentationLinks: MutableList<ExternalDocumentationLink> = mutableListOf()
+ @Input
+ @Optional
+ override var languageVersion: String? = null
+ @Input
+ @Optional
+ override var apiVersion: String? = null
+ @Input
+ override var noStdlibLink: Boolean = DokkaDefaults.noStdlibLink
+ @Input
+ override var noJdkLink: Boolean = DokkaDefaults.noJdkLink
+ @Input
+ var noAndroidSdkLink: Boolean = false
+ @Input
+ override var suppressedFiles: List<String> = emptyList()
+ @Input
+ override var analysisPlatform: Platform = DokkaDefaults.analysisPlatform
+ @Input
+ @Optional
+ var platform: String? = null
+ @Transient
+ var collectKotlinTasks: (() -> List<Any?>?)? = null
fun kotlinTasks(taskSupplier: Callable<List<Any>>) {
collectKotlinTasks = { taskSupplier.call() }
@@ -117,25 +147,25 @@ class GradleExternalDocumentationLinkImpl : ExternalDocumentationLink, Serializa
override var packageListUrl: URL = URL("http://")
}
-class GradleDokkaModuleDescription: DokkaModuleDescription {
+class GradleDokkaModuleDescription : DokkaModuleDescription {
override var name: String = ""
override var path: String = ""
override var docFile: String = ""
}
-class GradleDokkaConfigurationImpl: DokkaConfiguration {
+class GradleDokkaConfigurationImpl : DokkaConfiguration {
override var outputDir: String = ""
override var format: String = DokkaDefaults.format
override var cacheRoot: String? = DokkaDefaults.cacheRoot
override var offlineMode: Boolean = DokkaDefaults.offlineMode
override var failOnWarning: Boolean = DokkaDefaults.failOnWarning
- override var passesConfigurations: List<GradlePassConfigurationImpl> = emptyList()
+ override var sourceSets: List<GradleDokkaSourceSet> = emptyList()
override var pluginsClasspath: List<File> = emptyList()
override var pluginsConfiguration: Map<String, String> = mutableMapOf()
override var modules: List<GradleDokkaModuleDescription> = emptyList()
}
-class GradlePackageOptionsImpl: PackageOptions, Serializable {
+class GradlePackageOptionsImpl : PackageOptions, Serializable {
override var prefix: String = ""
override var includeNonPublic: Boolean = DokkaDefaults.includeNonPublic
override var reportUndocumented: Boolean = DokkaDefaults.reportUndocumented
@@ -143,8 +173,8 @@ class GradlePackageOptionsImpl: PackageOptions, Serializable {
override var suppress: Boolean = DokkaDefaults.suppress
}
-internal fun GradlePassConfigurationImpl.copy(): GradlePassConfigurationImpl {
- val newObj = GradlePassConfigurationImpl(this.name)
+internal fun GradleDokkaSourceSet.copy(): GradleDokkaSourceSet {
+ val newObj = GradleDokkaSourceSet(this.name)
this::class.memberProperties.forEach { field ->
if (field is KMutableProperty<*>) {
val value = field.getter.call(this)
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
index 41d6e67a..2b076fd0 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
@@ -57,7 +57,7 @@ open class DokkaPlugin : Plugin<Project> {
project.tasks.create(DOKKA_TASK_NAME, taskClass)
}
project.tasks.withType(taskClass) { task ->
- task.dokkaSourceSets = project.container(GradlePassConfigurationImpl::class.java)
+ task.dokkaSourceSets = project.container(GradleDokkaSourceSet::class.java)
task.dokkaRuntime = runtimeConfiguration
task.pluginsClasspathConfiguration = pluginsConfiguration
task.outputDirectory = File(project.buildDir, DOKKA_TASK_NAME).absolutePath
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
index 1ef04772..b0baabee 100644
--- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
+++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
@@ -29,7 +29,6 @@ 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.PackageOptions
import java.io.File
import java.net.URL
@@ -187,7 +186,7 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
throw MojoExecutionException("Incorrect path property, only Unix based path allowed.")
}
}
- fun defaultLinks(config: PassConfigurationImpl): List<ExternalDocumentationLinkImpl> {
+ fun defaultLinks(config: DokkaSourceSetImpl): List<ExternalDocumentationLinkImpl> {
val links = mutableListOf<ExternalDocumentationLinkImpl>()
if (!config.noJdkLink)
links += DokkaConfiguration.ExternalDocumentationLink
@@ -201,7 +200,7 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
return links
}
- val passConfiguration = PassConfigurationImpl(
+ val sourceSet = DokkaSourceSetImpl(
moduleName = moduleName,
displayName = displayName,
sourceSetID = sourceSetName,
@@ -246,8 +245,8 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
format = getOutFormat(),
offlineMode = offlineMode,
cacheRoot = cacheRoot,
- passesConfigurations = listOf(passConfiguration).also {
- if (passConfiguration.moduleName.isEmpty()) logger.warn("Not specified module name. It can result in unexpected behaviour while including documentation for module")
+ sourceSets = listOf(sourceSet).also {
+ if (sourceSet.moduleName.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) }.flatten(),