aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
Diffstat (limited to 'runners')
-rw-r--r--runners/cli/src/main/kotlin/cli/main.kt7
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt1
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt14
-rw-r--r--runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt9
4 files changed, 21 insertions, 10 deletions
diff --git a/runners/cli/src/main/kotlin/cli/main.kt b/runners/cli/src/main/kotlin/cli/main.kt
index b11ed0dc..42ac1806 100644
--- a/runners/cli/src/main/kotlin/cli/main.kt
+++ b/runners/cli/src/main/kotlin/cli/main.kt
@@ -76,6 +76,13 @@ class GlobalArguments(args: Array<String>) : DokkaConfiguration {
override val suppressObviousFunctions: Boolean by lazy{ !noSuppressObviousFunctions }
+ private val _includes by parser.option(
+ ArgTypeFile,
+ description = "Markdown files that would be displayed in multi-module page separated by the semicolon `;`)"
+ ).delimiter(";")
+
+ override val includes: Set<File> by lazy { _includes.toSet() }
+
val globalPackageOptions by parser.option(
ArgType.String,
description = "List of package source sets in format \"prefix,-deprecated,-privateApi,+warnUndocumented,+suppress;...\" "
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
index d2506f7a..6c1e6ab6 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaTask.kt
@@ -19,7 +19,6 @@ import org.jetbrains.dokka.plugability.ConfigurableBlock
import org.jetbrains.dokka.plugability.DokkaPlugin
import java.io.File
import java.util.function.BiConsumer
-import kotlin.reflect.KClass
import kotlin.reflect.full.createInstance
abstract class AbstractDokkaTask : DefaultTask() {
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt
index c68b53b8..b0683204 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTask.kt
@@ -1,11 +1,9 @@
package org.jetbrains.dokka.gradle
+import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.internal.tasks.TaskDependencyInternal
import org.gradle.api.provider.Property
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.InputFiles
-import org.gradle.api.tasks.Internal
-import org.gradle.api.tasks.OutputDirectories
+import org.gradle.api.tasks.*
import org.jetbrains.dokka.DokkaConfigurationImpl
import org.jetbrains.dokka.DokkaModuleDescriptionImpl
import java.io.File
@@ -17,6 +15,9 @@ typealias DokkaMultimoduleTask = DokkaMultiModuleTask
private typealias TaskPath = String
abstract class DokkaMultiModuleTask : AbstractDokkaParentTask() {
+ @InputFiles
+ @Optional
+ val includes: ConfigurableFileCollection = project.files()
@Internal
val fileLayout: Property<DokkaMultiModuleFileLayout> = project.objects.safeProperty<DokkaMultiModuleFileLayout>()
@@ -32,7 +33,7 @@ abstract class DokkaMultiModuleTask : AbstractDokkaParentTask() {
@get:Input
internal val childDokkaTaskIncludes: Map<TaskPath, Set<File>>
- get() = childDokkaTasks.filterIsInstance<DokkaTask>().associate { task ->
+ get() = childDokkaTasks.filterIsInstance<DokkaTaskPartial>().associate { task ->
task.path to task.dokkaSourceSets.flatMap { it.includes }.toSet()
}
@@ -61,7 +62,8 @@ abstract class DokkaMultiModuleTask : AbstractDokkaParentTask() {
includes = childDokkaTaskIncludes[dokkaTask.path].orEmpty(),
sourceOutputDirectory = dokkaTask.outputDirectory.getSafe()
)
- }
+ },
+ includes = includes.toSet(),
)
}
diff --git a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt
index cc9d8706..54f01fa5 100644
--- a/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt
+++ b/runners/gradle-plugin/src/test/kotlin/org/jetbrains/dokka/gradle/DokkaMultiModuleTaskTest.kt
@@ -22,7 +22,7 @@ class DokkaMultiModuleTaskTest {
.withProjectDir(rootProject.projectDir.resolve("child"))
.withParent(rootProject).build()
- private val childDokkaTask = childProject.tasks.create<DokkaTask>("childDokkaTask")
+ private val childDokkaTask = childProject.tasks.create<DokkaTaskPartial>("childDokkaTask")
private val multiModuleTask = rootProject.tasks.create<DokkaMultiModuleTask>("multiModuleTask").apply {
addChildTask(childDokkaTask)
@@ -53,6 +53,7 @@ class DokkaMultiModuleTaskTest {
fun buildDokkaConfiguration() {
val include1 = childDokkaTask.project.file("include1.md")
val include2 = childDokkaTask.project.file("include2.md")
+ val topLevelInclude = multiModuleTask.project.file("README.md")
childDokkaTask.apply {
dokkaSourceSets.create("main")
@@ -69,6 +70,7 @@ class DokkaMultiModuleTaskTest {
pluginsConfiguration.add(PluginConfigurationImpl("pluginA", DokkaConfiguration.SerializationFormat.JSON, """ { "key" : "value2" } """))
failOnWarning by true
offlineMode by true
+ includes.from(listOf(topLevelInclude))
}
val dokkaConfiguration = multiModuleTask.buildDokkaConfiguration()
@@ -81,6 +83,7 @@ class DokkaMultiModuleTaskTest {
pluginsClasspath = emptyList(),
failOnWarning = true,
offlineMode = true,
+ includes = setOf(topLevelInclude),
modules = listOf(
DokkaModuleDescriptionImpl(
name = "child",
@@ -100,7 +103,7 @@ class DokkaMultiModuleTaskTest {
assertEquals(1, dependenciesInitial.size, "Expected one dependency")
val dependency = dependenciesInitial.single()
- assertTrue(dependency is DokkaTask, "Expected dependency to be of Type ${DokkaTask::class.simpleName}")
+ assertTrue(dependency is DokkaTaskPartial, "Expected dependency to be of Type ${DokkaTaskPartial::class.simpleName}")
assertEquals(childProject, dependency.project, "Expected dependency from child project")
@@ -138,7 +141,7 @@ class DokkaMultiModuleTaskTest {
}
val secondChildDokkaTaskInclude = childProject.file("include4")
- val secondChildDokkaTask = childProject.tasks.create<DokkaTask>("secondChildDokkaTask") {
+ val secondChildDokkaTask = childProject.tasks.create<DokkaTaskPartial>("secondChildDokkaTask") {
dokkaSourceSets.create("main") {
it.includes.from(secondChildDokkaTaskInclude)
}