aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin
diff options
context:
space:
mode:
authorFilip ZybaƂa <fzybala@virtuslab.com>2020-05-13 16:05:42 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-06-25 16:19:29 +0200
commitf861b3738a75a5acc112d98b760bd1ada1023882 (patch)
treea0e1c0b4ceab2986610b0fc6173b2f6b42abc4cd /plugins/base/src/main/kotlin
parente86d98a8bff36795da88f53472cb995bcbb50f19 (diff)
downloaddokka-f861b3738a75a5acc112d98b760bd1ada1023882.tar.gz
dokka-f861b3738a75a5acc112d98b760bd1ada1023882.tar.bz2
dokka-f861b3738a75a5acc112d98b760bd1ada1023882.zip
Added support for includeNonPublic option in top-level and package-level. Added tests for it.
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r--plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt19
1 files changed, 15 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt
index d3fc65fb..66c917c5 100644
--- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt
+++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilter.kt
@@ -14,17 +14,25 @@ internal class DocumentableVisibilityFilter(val context: DokkaContext) : PreMerg
val packageOptions =
context.configuration.passesConfigurations.first { original.sourceSets.contains(context.sourceSet(it)) }
.perPackageOptions
+ val passOptions = context.configuration.passesConfigurations.first {
+ original.platformData.contains(it.platformData)
+ }
- DocumentableFilter(packageOptions).processModule(original)
+ DocumentableFilter(packageOptions, passOptions).processModule(original)
}
- private class DocumentableFilter(val packageOptions: List<DokkaConfiguration.PackageOptions>) {
+ private class DocumentableFilter(
+ val packageOptions: List<DokkaConfiguration.PackageOptions>,
+ val globalOptions: DokkaConfiguration.PassConfiguration
+ ) {
fun Visibility.isAllowedInPackage(packageName: String?) = when (this) {
is JavaVisibility.Public,
is JavaVisibility.Default,
is KotlinVisibility.Public -> true
- else -> packageName != null && packageOptions.firstOrNull { packageName.startsWith(it.prefix) }?.includeNonPublic == true
+ else -> packageName != null
+ && packageOptions.firstOrNull { packageName.startsWith(it.prefix) }?.includeNonPublic
+ ?: globalOptions.includeNonPublic
}
fun processModule(original: DModule) =
@@ -58,7 +66,10 @@ internal class DocumentableVisibilityFilter(val context: DokkaContext) : PreMerg
}
when {
!modified -> it
- functions.isEmpty() && properties.isEmpty() && classlikes.isEmpty() -> null
+ functions.isEmpty() && properties.isEmpty() && classlikes.isEmpty() -> {
+ packagesListChanged = true
+ null
+ }
else -> {
packagesListChanged = true
DPackage(