From f39971875c4f7d98dc1add2a8ed949d22b25600b Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Mon, 20 Jul 2020 14:20:17 +0200 Subject: Re-introduce default DokkaCollectorTask, run on all submodules by default, add Collector0IntegrationTest --- .../main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt | 6 ++---- .../src/main/kotlin/org/jetbrains/dokka/gradle/main.kt | 9 ++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'runners/gradle-plugin/src/main/kotlin/org/jetbrains') 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 4beb4b91..8d337795 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 @@ -3,6 +3,7 @@ package org.jetbrains.dokka.gradle import com.google.gson.GsonBuilder import org.gradle.api.plugins.JavaBasePlugin.DOCUMENTATION_GROUP import org.gradle.api.tasks.Input +import org.jetbrains.dokka.toJsonString open class DokkaCollectorTask : AbstractDokkaTask() { @@ -21,7 +22,6 @@ open class DokkaCollectorTask : AbstractDokkaTask() { cacheRoot = configurations.first().cacheRoot } - // TODO this certainly not the ideal solution val configuration = configurations.fold(initial) { acc, it: GradleDokkaConfigurationImpl -> if (acc.cacheRoot != it.cacheRoot) throw IllegalStateException("Dokka task configurations differ on core argument cacheRoot") @@ -31,9 +31,7 @@ open class DokkaCollectorTask : AbstractDokkaTask() { } val bootstrap = DokkaBootstrap("org.jetbrains.dokka.DokkaBootstrapImpl") - bootstrap.configure( - GsonBuilder().setPrettyPrinting().create().toJson(configuration) - ) { level, message -> + bootstrap.configure(configuration.toJsonString()) { level, message -> when (level) { "debug" -> logger.debug(message) "info" -> logger.info(message) 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 ff83fcef..51356703 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 @@ -11,7 +11,7 @@ open class DokkaPlugin : Plugin { project.setupDokkaTasks( name = "dokkaJavadoc", - multimoduleTaskSupported = false, + multimoduleTaskSupported = false ) { plugins.dependencies.add(project.dokkaArtifacts.javadocPlugin) } @@ -32,6 +32,7 @@ open class DokkaPlugin : Plugin { private fun Project.setupDokkaTasks( name: String, multimoduleTaskSupported: Boolean = true, + collectorTaskSupported: Boolean = true, configuration: AbstractDokkaTask.() -> Unit = {} ) { project.maybeCreateDokkaPluginConfiguration(name) @@ -50,6 +51,12 @@ open class DokkaPlugin : Plugin { configuration() } } + if (collectorTaskSupported) { + project.tasks.register("${name}Collector") { + modules = project.subprojects.map(Project::getName) + dokkaTaskNames = dokkaTaskNames + name + } + } } } } -- cgit