aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-20 14:20:17 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-20 16:37:49 +0200
commitf39971875c4f7d98dc1add2a8ed949d22b25600b (patch)
tree222ff081a1ab54b2ef1f164c52e9312004581202 /runners/gradle-plugin
parentac649efd3190237e22d79b59db436a4511f5e1b7 (diff)
downloaddokka-f39971875c4f7d98dc1add2a8ed949d22b25600b.tar.gz
dokka-f39971875c4f7d98dc1add2a8ed949d22b25600b.tar.bz2
dokka-f39971875c4f7d98dc1add2a8ed949d22b25600b.zip
Re-introduce default DokkaCollectorTask, run on all submodules by default, add Collector0IntegrationTest
Diffstat (limited to 'runners/gradle-plugin')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt6
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt9
2 files changed, 10 insertions, 5 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 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> {
project.setupDokkaTasks(
name = "dokkaJavadoc",
- multimoduleTaskSupported = false,
+ multimoduleTaskSupported = false
) {
plugins.dependencies.add(project.dokkaArtifacts.javadocPlugin)
}
@@ -32,6 +32,7 @@ open class DokkaPlugin : Plugin<Project> {
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<Project> {
configuration()
}
}
+ if (collectorTaskSupported) {
+ project.tasks.register<DokkaCollectorTask>("${name}Collector") {
+ modules = project.subprojects.map(Project::getName)
+ dokkaTaskNames = dokkaTaskNames + name
+ }
+ }
}
}
}