diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-07-17 14:19:59 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-07-17 17:25:37 +0200 |
commit | c1cf73eb84cb73bd28972355c4c87db3ea7b236d (patch) | |
tree | 1e647a0804d6b9e1a0af4d893bbe49e788fde300 /runners/gradle-plugin/src/main/kotlin/org | |
parent | 3f26229f65f3bfd62fbdb49bb1b557c1ec9fbab4 (diff) | |
download | dokka-c1cf73eb84cb73bd28972355c4c87db3ea7b236d.tar.gz dokka-c1cf73eb84cb73bd28972355c4c87db3ea7b236d.tar.bz2 dokka-c1cf73eb84cb73bd28972355c4c87db3ea7b236d.zip |
Fix DokkaCollector task to run on its own
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin/org')
-rw-r--r-- | runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaCollectorTask.kt | 36 |
1 files changed, 17 insertions, 19 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 6a07d9c1..4beb4b91 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 @@ -1,33 +1,18 @@ package org.jetbrains.dokka.gradle -import org.gradle.api.DefaultTask -import org.gradle.api.plugins.JavaBasePlugin +import com.google.gson.GsonBuilder import org.gradle.api.plugins.JavaBasePlugin.DOCUMENTATION_GROUP import org.gradle.api.tasks.Input -import org.gradle.api.tasks.TaskAction -import org.gradle.api.tasks.TaskDependency -import java.lang.IllegalStateException -open class DokkaCollectorTask : DefaultTask() { +open class DokkaCollectorTask : AbstractDokkaTask() { @Input var modules: List<String> = emptyList() @Input - var outputDirectory: String = defaultDokkaOutputDirectory().absolutePath - - @Input var dokkaTaskNames: Set<String> = setOf() - override fun getFinalizedBy(): TaskDependency { - val dokkaTasks = getSubprojectDokkaTasks(dokkaTaskNames) - dokkaTasks.forEach { dokkaTask -> finalizedBy(dokkaTask) } - dokkaTasks.zipWithNext().forEach { (first, second) -> first.mustRunAfter(second) } - return super.getFinalizedBy() - } - - @TaskAction - fun collect() { + override fun generate() { val configurations = getSubprojectDokkaTasks(dokkaTaskNames) .mapNotNull { dokkaTask -> dokkaTask.getConfigurationOrNull() } @@ -44,7 +29,20 @@ open class DokkaCollectorTask : DefaultTask() { acc.pluginsClasspath = (acc.pluginsClasspath + it.pluginsClasspath).distinct() acc } - getSubprojectDokkaTasks(dokkaTaskNames).forEach { it.enforcedConfiguration = configuration } + + val bootstrap = DokkaBootstrap("org.jetbrains.dokka.DokkaBootstrapImpl") + bootstrap.configure( + GsonBuilder().setPrettyPrinting().create().toJson(configuration) + ) { level, message -> + when (level) { + "debug" -> logger.debug(message) + "info" -> logger.info(message) + "progress" -> logger.lifecycle(message) + "warn" -> logger.warn(message) + "error" -> logger.error(message) + } + } + bootstrap.generate() } private fun getSubprojectDokkaTasks(dokkaTaskName: String): List<DokkaTask> { |