aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
Diffstat (limited to 'runners')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaMultimoduleTask.kt33
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt4
3 files changed, 25 insertions, 14 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
index 0270dbe2..38da9631 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt
@@ -16,7 +16,7 @@ open class DokkaCollectorTask : DefaultTask() {
private lateinit var configuration: GradleDokkaConfigurationImpl
@Input
- val dokkaTaskNames: MutableSet<String> = mutableSetOf()
+ var dokkaTaskNames: Set<String> = setOf()
@TaskAction
fun collect() {
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 affab485..cc7b8d86 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
@@ -12,7 +12,12 @@ open class DokkaMultimoduleTask : AbstractDokkaTask(), Configurable {
@Input
- val dokkaTaskNames: MutableSet<String> = mutableSetOf()
+ var dokkaTaskNames: Set<String> = setOf()
+ set(value) {
+ field = value.toSet()
+ setDependsOn(getSubprojectDokkaTasks(value))
+ }
+
override fun generate() {
val bootstrap = DokkaBootstrap("org.jetbrains.dokka.DokkaMultimoduleBootstrapImpl")
@@ -36,16 +41,22 @@ open class DokkaMultimoduleTask : AbstractDokkaTask(), Configurable {
outputDir = project.file(outputDirectory).absolutePath
pluginsClasspath = plugins.resolve().toList()
pluginsConfiguration = this@DokkaMultimoduleTask.pluginsConfiguration
- modules = project.subprojects
- .flatMap { subProject -> dokkaTaskNames.mapNotNull(subProject.tasks::findByName) }
- .filterIsInstance<DokkaTask>()
- .map { dokkaTask ->
- GradleDokkaModuleDescription().apply {
- name = dokkaTask.project.name
- path = dokkaTask.project.projectDir.resolve(dokkaTask.outputDirectory)
- .toRelativeString(project.file(outputDirectory))
- docFile = dokkaTask.project.projectDir.resolve(documentationFileName).absolutePath
- }
+ modules = getSubprojectDokkaTasks(dokkaTaskNames).map { dokkaTask ->
+ GradleDokkaModuleDescription().apply {
+ name = dokkaTask.project.name
+ path = dokkaTask.project.projectDir.resolve(dokkaTask.outputDirectory)
+ .toRelativeString(project.file(outputDirectory))
+ docFile = dokkaTask.project.projectDir.resolve(documentationFileName).absolutePath
}
+ }
}
+
+ private fun getSubprojectDokkaTasks(dokkaTaskName: String): List<DokkaTask> {
+ return project.subprojects
+ .mapNotNull { subproject -> subproject.tasks.findByName(dokkaTaskName) as? DokkaTask }
+ }
+
+ private fun getSubprojectDokkaTasks(dokkaTaskNames: Set<String>): List<DokkaTask> {
+ return dokkaTaskNames.flatMap { dokkaTaskName -> getSubprojectDokkaTasks(dokkaTaskName) }
+ }
}
diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
index a851ee13..5bf76880 100644
--- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt
@@ -37,12 +37,12 @@ open class DokkaPlugin : Plugin<Project> {
project.maybeCreateDokkaPluginConfiguration(multimoduleName)
project.maybeCreateDokkaRuntimeConfiguration(multimoduleName)
project.tasks.register<DokkaMultimoduleTask>(multimoduleName) {
- dokkaTaskNames.add(name)
+ dokkaTaskNames = dokkaTaskNames + name
configuration()
}
project.tasks.register<DokkaCollectorTask>("${name}Collector") {
- dokkaTaskNames.add(name)
+ dokkaTaskNames = dokkaTaskNames + name
}
}
}