aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt2
-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
4 files changed, 26 insertions, 15 deletions
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt
index 95b6e683..821ae08b 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multimodule0IntegrationTest.kt
@@ -26,7 +26,7 @@ class Multimodule0IntegrationTest(override val versions: BuildVersions) : Abstra
@Test
fun execute() {
- val result = createGradleRunner("dokkaHtml", ":moduleA:dokkaHtmlMultimodule", "--stacktrace").build()
+ val result = createGradleRunner(":moduleA:dokkaHtmlMultimodule", "--stacktrace").build()
assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":moduleA:dokkaHtmlMultimodule")).outcome)
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
}
}
}