aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Kotlin
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-03 16:25:50 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-04 14:35:09 +0300
commit3b6e3a8bf69b7470cd7e9a867ff3b2e7e645fbd4 (patch)
treea2cf05b5734bdb6540466a0e56b4fc4e34d792a4 /core/src/main/kotlin/Kotlin
parentc2afb348bb0d3dd60d336aa312b5fcedfb31b966 (diff)
downloaddokka-3b6e3a8bf69b7470cd7e9a867ff3b2e7e645fbd4.tar.gz
dokka-3b6e3a8bf69b7470cd7e9a867ff3b2e7e645fbd4.tar.bz2
dokka-3b6e3a8bf69b7470cd7e9a867ff3b2e7e645fbd4.zip
Add bunch of new parameters to runners
Such as packageOptions, impliedPlatforms and so on
Diffstat (limited to 'core/src/main/kotlin/Kotlin')
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt19
1 files changed, 9 insertions, 10 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index aa4eed24..b034a299 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -3,6 +3,7 @@ package org.jetbrains.dokka
import com.google.inject.Inject
import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.PsiJavaFile
+import org.jetbrains.dokka.DokkaConfiguration.PackageOptions
import org.jetbrains.dokka.DokkaConfiguration.SourceLinkDefinition
import org.jetbrains.dokka.Kotlin.DescriptorDocumentationParser
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
@@ -44,21 +45,19 @@ class DocumentationOptions(val outputDir: String,
val impliedPlatforms: List<String> = emptyList(),
// Sorted by pattern length
perPackageOptions: List<PackageOptions> = emptyList()) {
- val perPackageOptions = perPackageOptions.sortedByDescending { it.prefix.length } + PackageOptions("", includeNonPublic, reportUndocumented, skipDeprecated)
+ init {
+ if (perPackageOptions.any { it.prefix == "" })
+ throw IllegalArgumentException("Please do not register packageOptions with all match pattern, use global settings instead")
+ }
+
+ val perPackageOptions = perPackageOptions.sortedByDescending { it.prefix.length }
+ val rootPackageOptions = PackageOptionsImpl("", includeNonPublic, reportUndocumented, skipDeprecated)
- fun effectivePackageOptions(pack: String): PackageOptions = perPackageOptions.first { pack.startsWith(it.prefix) }
+ fun effectivePackageOptions(pack: String): PackageOptions = perPackageOptions.firstOrNull { pack.startsWith(it.prefix + ".") } ?: rootPackageOptions
fun effectivePackageOptions(pack: FqName): PackageOptions = effectivePackageOptions(pack.asString())
}
-
-data class PackageOptions(val prefix: String,
- val includeNonPublic: Boolean = false,
- val reportUndocumented: Boolean = true,
- val skipDeprecated: Boolean = false)
-
-
-
private fun isExtensionForExternalClass(extensionFunctionDescriptor: DeclarationDescriptor,
extensionReceiverDescriptor: DeclarationDescriptor,
allFqNames: Collection<FqName>): Boolean {