diff options
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin/org')
5 files changed, 17 insertions, 7 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 da834775..dc94cc7f 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 @@ -14,7 +14,7 @@ open class DokkaCollectorTask : DefaultTask() { var modules: List<String> = emptyList() @Input - var outputDirectory: String = "" + var outputDirectory: String = defaultDokkaOutputDirectory().absolutePath private lateinit var configuration: GradleDokkaConfigurationImpl 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 76a2e80a..dd0a5d04 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 @@ -21,7 +21,7 @@ open class DokkaMultimoduleTask : DefaultTask(), Configurable { var documentationFileName: String = "README.md" @Input - var outputDirectory: String = "" + var outputDirectory: String = defaultDokkaOutputDirectory().absolutePath @Input val dokkaTaskNames: MutableSet<String> = mutableSetOf() diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt index bc2fa769..b755c5aa 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt @@ -44,7 +44,7 @@ open class DokkaTask : DefaultTask(), Configurable { } @Input - var outputDirectory: String = "" + var outputDirectory: String = defaultDokkaOutputDirectory().absolutePath @Input var subProjects: List<String> = emptyList() diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/defaultDokkaOutputDirectory.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/defaultDokkaOutputDirectory.kt new file mode 100644 index 00000000..0a7ab534 --- /dev/null +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/defaultDokkaOutputDirectory.kt @@ -0,0 +1,13 @@ +package org.jetbrains.dokka.gradle + +import org.gradle.api.Task +import java.io.File + +internal fun Task.defaultDokkaOutputDirectory(): File { + return defaultDokkaOutputDirectory(project.buildDir, name) +} + +internal fun defaultDokkaOutputDirectory(buildDir: File, taskName: String): File { + val formatClassifier = taskName.removePrefix("dokka").decapitalize() + return File(buildDir, "dokka${File.separator}$formatClassifier") +} 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 df854cd9..7fb0fe7d 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 @@ -3,11 +3,11 @@ package org.jetbrains.dokka.gradle import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.create -import java.io.File open class DokkaPlugin : Plugin<Project> { override fun apply(project: Project) { project.createDokkaTasks("dokka") { + outputDirectory = defaultDokkaOutputDirectory(project.buildDir, "dokkaKdoc").absolutePath doFirst { logger.warn(":dokka task is deprecated in favor of :dokkaKdoc") } @@ -43,17 +43,14 @@ open class DokkaPlugin : Plugin<Project> { */ private fun Project.createDokkaTasks(name: String, configuration: DokkaTask.() -> Unit = {}) { project.tasks.create<DokkaTask>(name) { - outputDirectory = File(buildDir, name).absolutePath configuration() } project.tasks.create<DokkaCollectorTask>("${name}Collector") { - outputDirectory = File(buildDir, name).absolutePath dokkaTaskNames.add(name) } project.tasks.create<DokkaMultimoduleTask>("${name}Multimodule") { - outputDirectory = File(buildDir, name).absolutePath dokkaTaskNames.add(name) } } |