aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/kotlin/DokkaBootstrapImpl.kt2
-rw-r--r--core/src/main/kotlin/Generation/DokkaGenerator.kt8
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt2
-rw-r--r--core/src/test/kotlin/TestAPI.kt1
-rw-r--r--integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt1
-rw-r--r--runners/gradle-plugin/src/main/kotlin/main.kt1
6 files changed, 12 insertions, 3 deletions
diff --git a/core/src/main/kotlin/DokkaBootstrapImpl.kt b/core/src/main/kotlin/DokkaBootstrapImpl.kt
index 5f3fc7b3..8038089f 100644
--- a/core/src/main/kotlin/DokkaBootstrapImpl.kt
+++ b/core/src/main/kotlin/DokkaBootstrapImpl.kt
@@ -42,6 +42,7 @@ class DokkaBootstrapImpl : DokkaBootstrap {
outputDir: String,
format: String,
includeNonPublic: Boolean,
+ includeRootPackage: Boolean,
reportUndocumented: Boolean,
skipEmptyPackages: Boolean,
skipDeprecated: Boolean,
@@ -59,6 +60,7 @@ class DokkaBootstrapImpl : DokkaBootstrap {
outputDir,
format,
includeNonPublic,
+ includeRootPackage,
reportUndocumented,
skipEmptyPackages,
skipDeprecated,
diff --git a/core/src/main/kotlin/Generation/DokkaGenerator.kt b/core/src/main/kotlin/Generation/DokkaGenerator.kt
index 2c1cdb03..b7163a5c 100644
--- a/core/src/main/kotlin/Generation/DokkaGenerator.kt
+++ b/core/src/main/kotlin/Generation/DokkaGenerator.kt
@@ -148,9 +148,11 @@ fun buildDocumentationModule(injector: Injector,
for (include in includes) {
packageDocs.parse(include, fragments.firstOrNull())
}
- documentationModule.updateContent {
- for (node in packageDocs.moduleContent.children) {
- append(node)
+ if (documentationModule.content.isEmpty()) {
+ documentationModule.updateContent {
+ for (node in packageDocs.moduleContent.children) {
+ append(node)
+ }
}
}
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index 10b5c598..4974b765 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -33,6 +33,7 @@ import com.google.inject.name.Named as GuiceNamed
data class DocumentationOptions(val outputDir: String,
val outputFormat: String,
val includeNonPublic: Boolean = false,
+ val includeRootPackage: Boolean = false,
val reportUndocumented: Boolean = true,
val skipEmptyPackages: Boolean = true,
val skipDeprecated: Boolean = false,
@@ -337,6 +338,7 @@ class DocumentationBuilder
val allFqNames = fragments.map { it.fqName }.distinct()
for (packageName in allFqNames) {
+ if (packageName.isRoot && !options.includeRootPackage) continue
val declarations = fragments.filter { it.fqName == packageName }.flatMap { it.getMemberScope().getContributedDescriptors() }
if (options.skipEmptyPackages && declarations.none { it.isDocumented(options) }) continue
diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt
index d2af4830..09a346cf 100644
--- a/core/src/test/kotlin/TestAPI.kt
+++ b/core/src/test/kotlin/TestAPI.kt
@@ -28,6 +28,7 @@ fun verifyModel(vararg roots: ContentRoot,
val options = DocumentationOptions("", format,
includeNonPublic = includeNonPublic,
skipEmptyPackages = false,
+ includeRootPackage = true,
sourceLinks = listOf<SourceLinkDefinition>(),
generateIndexPages = false)
diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt b/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt
index 50e8fb8d..845f86a6 100644
--- a/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt
+++ b/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt
@@ -13,6 +13,7 @@ interface DokkaBootstrap {
outputDir: String,
format: String,
includeNonPublic: Boolean,
+ includeRootPackage: Boolean,
reportUndocumented: Boolean,
skipEmptyPackages: Boolean,
skipDeprecated: Boolean,
diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt
index 7ed83473..3a78080c 100644
--- a/runners/gradle-plugin/src/main/kotlin/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/main.kt
@@ -159,6 +159,7 @@ open class DokkaTask : DefaultTask() {
outputDirectory,
outputFormat,
false,
+ false,
reportNotDocumented,
skipEmptyPackages,
skipDeprecated,