diff options
Diffstat (limited to 'core')
4 files changed, 6 insertions, 10 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt index 584d8b8c..6d6d8698 100644 --- a/core/src/main/kotlin/DokkaBootstrapImpl.kt +++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt @@ -7,11 +7,7 @@ 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" - ) + val matchingRegex = it.first() val args = it.subList(1, it.size) @@ -28,7 +24,7 @@ fun parsePerPackageOptions(args: List<String>): List<PackageOptions> = args.map ?: DokkaDefaults.suppress PackageOptionsImpl( - prefix, + matchingRegex, includeNonPublic = privateApi, reportUndocumented = reportUndocumented, skipDeprecated = !deprecated, diff --git a/core/src/main/kotlin/configuration.kt b/core/src/main/kotlin/configuration.kt index bc097ae4..15525152 100644 --- a/core/src/main/kotlin/configuration.kt +++ b/core/src/main/kotlin/configuration.kt @@ -144,7 +144,7 @@ interface DokkaConfiguration : Serializable { } interface PackageOptions : Serializable { - val prefix: String + val matchingRegex: String val includeNonPublic: Boolean val reportUndocumented: Boolean? val skipDeprecated: Boolean diff --git a/core/src/main/kotlin/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt index 61c86c5a..240fb110 100644 --- a/core/src/main/kotlin/defaultConfiguration.kt +++ b/core/src/main/kotlin/defaultConfiguration.kt @@ -71,7 +71,7 @@ data class SourceLinkDefinitionImpl( } data class PackageOptionsImpl( - override val prefix: String, + override val matchingRegex: String, override val includeNonPublic: Boolean, override val reportUndocumented: Boolean?, override val skipDeprecated: Boolean, diff --git a/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt b/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt index 60769e9b..21548a4c 100644 --- a/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt +++ b/core/src/main/kotlin/transformers/documentation/PreMergeDocumentableTransformer.kt @@ -28,8 +28,8 @@ fun PreMergeDocumentableTransformer.sourceSet(documentable: Documentable): Dokka fun PreMergeDocumentableTransformer.perPackageOptions(documentable: Documentable): PackageOptions? { val packageName = documentable.dri.packageName ?: return null return sourceSet(documentable).perPackageOptions - .sortedByDescending { packageOptions -> packageOptions.prefix.length } - .firstOrNull { packageOptions -> packageName.startsWith(packageOptions.prefix) } + .sortedByDescending { packageOptions -> packageOptions.matchingRegex.length } + .firstOrNull { packageOptions -> Regex(packageOptions.matchingRegex).matches(packageName) } } fun <T> PreMergeDocumentableTransformer.source(documentable: T) where T : Documentable, T : WithSources = |