aboutsummaryrefslogtreecommitdiff
path: root/core/src
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 /core/src
parentc853a41545d461fee7af6f0e8aad11569c7d7d53 (diff)
downloaddokka-b1520f0a45e5102f77a43dd20746a3db047bbcf4.tar.gz
dokka-b1520f0a45e5102f77a43dd20746a3db047bbcf4.tar.bz2
dokka-b1520f0a45e5102f77a43dd20746a3db047bbcf4.zip
Implement default configurations
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt24
-rw-r--r--core/src/main/kotlin/configuration.kt27
2 files changed, 43 insertions, 8 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt
index e0f014c8..32248163 100644
--- a/core/src/main/kotlin/DokkaBootstrapImpl.kt
+++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt
@@ -11,12 +11,26 @@ import java.util.function.BiConsumer
fun parsePerPackageOptions(args: List<String>): List<PackageOptions> = args.map { it.split(",") }.map {
val prefix = it.first()
if (prefix == "")
- throw IllegalArgumentException("Please do not register packageOptions with all match pattern, use global settings instead")
+ throw IllegalArgumentException(
+ "Please do not register packageOptions with all match pattern, use global settings instead"
+ )
+
val args = it.subList(1, it.size)
- val deprecated = args.find { it.endsWith("deprecated") }?.startsWith("+") ?: true
- val reportUndocumented = args.find { it.endsWith("reportUndocumented") }?.startsWith("+") ?: true
- val privateApi = args.find { it.endsWith("privateApi") }?.startsWith("+") ?: false
- val suppress = args.find { it.endsWith("suppress") }?.startsWith("+") ?: false
+
+ val deprecated = args.find { it.endsWith("deprecated") }?.startsWith("+")
+ ?: args.find { it.endsWith("skipDeprecated") }?.startsWith("+")
+ ?: DokkaDefaults.skipDeprecated
+
+ val reportUndocumented = args.find { it.endsWith("reportUndocumented") }?.startsWith("+")
+ ?: DokkaDefaults.reportUndocumented
+
+ val privateApi = args.find { it.endsWith("privateApi") }?.startsWith("+")
+ ?: args.find { it.endsWith("includeNonPublic") }?.startsWith("+")
+ ?: DokkaDefaults.includeNonPublic
+
+ val suppress = args.find { it.endsWith("suppress") }?.startsWith("+")
+ ?:DokkaDefaults.suppress
+
PackageOptionsImpl(
prefix,
includeNonPublic = privateApi,
diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt
index f5115435..b016f83d 100644
--- a/core/src/main/kotlin/configuration.kt
+++ b/core/src/main/kotlin/configuration.kt
@@ -3,6 +3,25 @@ package org.jetbrains.dokka
import java.io.File
import java.net.URL
+object DokkaDefaults {
+ const val outputDir = "./dokka"
+ const val format: String = "html"
+ val cacheRoot: String? = null
+ const val offlineMode: Boolean = false
+ const val failOnWarning: Boolean = false
+
+ const val includeNonPublic: Boolean = false
+ const val includeRootPackage: Boolean = false
+ const val reportUndocumented: Boolean = false
+ const val skipEmptyPackages: Boolean = false
+ const val skipDeprecated: Boolean = false
+ const val jdkVersion: Int = 8
+ const val noStdlibLink: Boolean = false
+ const val noJdkLink: Boolean = false
+ val analysisPlatform: Platform = Platform.DEFAULT
+ const val suppress: Boolean = false
+}
+
enum class Platform(val key: String) {
jvm("jvm"),
js("js"),
@@ -29,11 +48,11 @@ interface DokkaConfiguration {
val format: String
val cacheRoot: String?
val offlineMode: Boolean
+ val failOnWarning: Boolean
val passesConfigurations: List<PassConfiguration>
val modules: List<DokkaModuleDescription>
val pluginsClasspath: List<File>
val pluginsConfiguration: Map<String, String>
- val failOnWarning: Boolean
interface PassConfiguration {
val moduleName: String
@@ -89,8 +108,10 @@ interface DokkaConfiguration {
val url: URL
val packageListUrl: URL
- open class Builder(open var url: URL? = null,
- open var packageListUrl: URL? = null) {
+ open class Builder(
+ open var url: URL? = null,
+ open var packageListUrl: URL? = null
+ ) {
constructor(root: String, packageList: String? = null) : this(URL(root), packageList?.let { URL(it) })