aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-06-16 15:35:17 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-06-18 15:34:36 +0200
commitb1520f0a45e5102f77a43dd20746a3db047bbcf4 (patch)
treec7463bdf771e21c4d33084e1f74be161f4a8af71 /runners
parentc853a41545d461fee7af6f0e8aad11569c7d7d53 (diff)
downloaddokka-b1520f0a45e5102f77a43dd20746a3db047bbcf4.tar.gz
dokka-b1520f0a45e5102f77a43dd20746a3db047bbcf4.tar.bz2
dokka-b1520f0a45e5102f77a43dd20746a3db047bbcf4.zip
Implement default configurations
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/configurationImplementations.kt35
-rw-r--r--runners/maven-plugin/src/main/kotlin/DokkaMojo.kt39
3 files changed, 51 insertions, 50 deletions
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index 515f9bb0..f0df08e0 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -3,6 +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.utilities.DokkaConsoleLogger
import org.jetbrains.kotlin.utils.addToStdlib.cast
import java.io.*
@@ -18,12 +19,12 @@ class GlobalArguments(args: Array<String>) : DokkaConfiguration {
val json: String? by parser.argument(ArgType.String, description = "Json file name").optional()
override val outputDir by parser.option(ArgType.String, description = "Output directory path")
- .default("./dokka")
+ .default(DokkaDefaults.outputDir)
override val format by parser.option(
ArgType.String,
description = "Output format (html, gfm, jekyll)"
- ).default("html")
+ ).default(DokkaDefaults.format)
override val cacheRoot by parser.option(
ArgType.String,
@@ -50,12 +51,12 @@ class GlobalArguments(args: Array<String>) : DokkaConfiguration {
override val offlineMode by parser.option(
ArgType.Boolean,
"Offline mode (do not download package lists from the Internet)"
- ).default(false)
+ ).default(DokkaDefaults.offlineMode)
override val failOnWarning by parser.option(
ArgType.Boolean,
"Throw an exception if the generation exited with warnings"
- ).default(false)
+ ).default(DokkaDefaults.failOnWarning)
val globalPackageOptions by parser.option(
ArgType.String,
@@ -160,26 +161,26 @@ fun passArguments(args: Array<String>): DokkaConfiguration.PassConfiguration {
).delimiter(";")
val includeNonPublic: Boolean by parser.option(ArgType.Boolean, description = "Include non public")
- .default(false)
+ .default(DokkaDefaults.includeNonPublic)
val includeRootPackage by parser.option(ArgType.Boolean, description = "Include non public")
- .default(false)
+ .default(DokkaDefaults.includeRootPackage)
val reportUndocumented by parser.option(ArgType.Boolean, description = "Report undocumented members")
- .default(false)
+ .default(DokkaDefaults.reportUndocumented)
val skipEmptyPackages by parser.option(
ArgType.Boolean,
description = "Do not create index pages for empty packages"
- ).default(false)
+ ).default(DokkaDefaults.skipEmptyPackages)
val skipDeprecated by parser.option(ArgType.Boolean, description = "Do not output deprecated members")
- .default(false)
+ .default(DokkaDefaults.skipDeprecated)
val jdkVersion by parser.option(
ArgType.Int,
description = "Version of JDK to use for linking to JDK JavaDoc"
- ).default(8)
+ ).default(DokkaDefaults.jdkVersion)
val languageVersion by parser.option(
ArgType.String,
@@ -192,10 +193,10 @@ fun passArguments(args: Array<String>): DokkaConfiguration.PassConfiguration {
)
val noStdlibLink by parser.option(ArgType.Boolean, description = "Disable documentation link to stdlib")
- .default(false)
+ .default(DokkaDefaults.noStdlibLink)
val noJdkLink by parser.option(ArgType.Boolean, description = "Disable documentation link to JDK")
- .default(false)
+ .default(DokkaDefaults.noJdkLink)
val suppressedFiles by parser.option(
ArgType.String,
@@ -205,7 +206,7 @@ fun passArguments(args: Array<String>): DokkaConfiguration.PassConfiguration {
val analysisPlatform: Platform by parser.option(
ArgTypePlatform,
description = "Platform for analysis"
- ).default(Platform.DEFAULT)
+ ).default(DokkaDefaults.analysisPlatform)
val perPackageOptions by parser.option(
ArgType.String,
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 152fa910..f4e7730e 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
@@ -7,6 +7,7 @@ import org.gradle.api.tasks.Optional
import org.gradle.util.ConfigureUtil
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.DokkaConfiguration.*
+import org.jetbrains.dokka.DokkaDefaults
import org.jetbrains.dokka.Platform
import java.io.File
import java.io.Serializable
@@ -33,22 +34,22 @@ open class GradlePassConfigurationImpl(@Transient val name: String = ""): PassCo
@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 = false
- @Input override var includeRootPackage: Boolean = false
- @Input override var reportUndocumented: Boolean = false
- @Input override var skipEmptyPackages: Boolean = false
- @Input override var skipDeprecated: Boolean = false
- @Input override var jdkVersion: Int = 8
+ @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 = false
- @Input override var noJdkLink: Boolean = false
+ @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 = Platform.DEFAULT
+ @Input override var analysisPlatform: Platform = DokkaDefaults.analysisPlatform
@Input @Optional var platform: String? = null
@Transient var collectKotlinTasks: (() -> List<Any?>?)? = null
@@ -124,22 +125,22 @@ class GradleDokkaModuleDescription: DokkaModuleDescription {
class GradleDokkaConfigurationImpl: DokkaConfiguration {
override var outputDir: String = ""
- override var format: String = "html"
- override var cacheRoot: String? = null
- override var offlineMode: Boolean = false
+ 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 pluginsClasspath: List<File> = emptyList()
override var pluginsConfiguration: Map<String, String> = mutableMapOf()
override var modules: List<GradleDokkaModuleDescription> = emptyList()
- override var failOnWarning: Boolean = false
}
class GradlePackageOptionsImpl: PackageOptions, Serializable {
override var prefix: String = ""
- override var includeNonPublic: Boolean = false
- override var reportUndocumented: Boolean = true
- override var skipDeprecated: Boolean = true
- override var suppress: Boolean = false
+ override var includeNonPublic: Boolean = DokkaDefaults.includeNonPublic
+ override var reportUndocumented: Boolean = DokkaDefaults.reportUndocumented
+ override var skipDeprecated: Boolean = DokkaDefaults.skipDeprecated
+ override var suppress: Boolean = DokkaDefaults.suppress
}
internal fun GradlePassConfigurationImpl.copy(): GradlePassConfigurationImpl {
diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt
index 5a739d5e..1ef04772 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.PackageOptions
import java.io.File
import java.net.URL
@@ -69,16 +70,16 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
override var prefix: String = ""
@Parameter
- override var includeNonPublic: Boolean = false
+ override var includeNonPublic: Boolean = DokkaDefaults.includeNonPublic
@Parameter
- override var reportUndocumented: Boolean = true
+ override var reportUndocumented: Boolean = DokkaDefaults.reportUndocumented
@Parameter
- override var skipDeprecated: Boolean = false
+ override var skipDeprecated: Boolean = DokkaDefaults.skipDeprecated
@Parameter
- override var suppress: Boolean = false
+ override var suppress: Boolean = DokkaDefaults.suppress
}
@Parameter(required = true, defaultValue = "\${project.sourceSet}")
@@ -90,7 +91,6 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
@Parameter
var sourceRoots: List<SourceRoot> = emptyList()
-
@Parameter
var dependentSourceSets: List<String> = emptyList()
@@ -112,17 +112,17 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
@Parameter(required = false, defaultValue = "false")
var skip: Boolean = false
- @Parameter(required = false, defaultValue = "6")
- var jdkVersion: Int = 8
+ @Parameter(required = false, defaultValue = "${DokkaDefaults.jdkVersion}")
+ var jdkVersion: Int = DokkaDefaults.jdkVersion
@Parameter
- var skipDeprecated: Boolean = false
+ var skipDeprecated: Boolean = DokkaDefaults.skipDeprecated
@Parameter
- var skipEmptyPackages: Boolean = true
+ var skipEmptyPackages: Boolean = DokkaDefaults.skipEmptyPackages
@Parameter
- var reportUndocumented: Boolean = true
+ var reportUndocumented: Boolean = DokkaDefaults.reportUndocumented
@Parameter
var impliedPlatforms: List<String> = emptyList()
@@ -133,11 +133,11 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
@Parameter
var externalDocumentationLinks: List<ExternalDocumentationLinkBuilder> = emptyList()
- @Parameter(defaultValue = "false")
- var noStdlibLink: Boolean = false
+ @Parameter(defaultValue = "${DokkaDefaults.noStdlibLink}")
+ var noStdlibLink: Boolean = DokkaDefaults.noStdlibLink
- @Parameter(defaultValue = "false")
- var noJdkLink: Boolean = false
+ @Parameter(defaultValue = "${DokkaDefaults.noJdkLink}")
+ var noJdkLink: Boolean = DokkaDefaults.noJdkLink
@Parameter
var cacheRoot: String? = null
@@ -145,8 +145,8 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
@Parameter(defaultValue = "JVM")
var displayName: String = "JVM"
- @Parameter(defaultValue = "false")
- var offlineMode: Boolean = false
+ @Parameter(defaultValue = "${DokkaDefaults.offlineMode}")
+ var offlineMode: Boolean = DokkaDefaults.offlineMode
@Parameter
var languageVersion: String? = null
@@ -155,20 +155,19 @@ abstract class AbstractDokkaMojo : AbstractMojo() {
var apiVersion: String? = null
@Parameter
- var includeRootPackage: Boolean = false
+ var includeRootPackage: Boolean = DokkaDefaults.includeRootPackage
@Parameter
var suppressedFiles: List<String> = emptyList()
-
@Parameter
var platform: String = ""
@Parameter
- var includeNonPublic: Boolean = false
+ var includeNonPublic: Boolean = DokkaDefaults.includeNonPublic
@Parameter
- var failOnWarning: Boolean = false
+ var failOnWarning: Boolean = DokkaDefaults.failOnWarning
@Parameter
var dokkaPlugins: List<Dependency> = emptyList()