aboutsummaryrefslogtreecommitdiff
path: root/runners
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-10 08:43:57 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-13 14:23:08 +0200
commit8c3396d480a35df33d999ca056fae7830ea11025 (patch)
tree202dace601641732fff8ed7a94ec849859673c9f /runners
parentaa6db6e2b51260b760551383c58358309f155686 (diff)
downloaddokka-8c3396d480a35df33d999ca056fae7830ea11025.tar.gz
dokka-8c3396d480a35df33d999ca056fae7830ea11025.tar.bz2
dokka-8c3396d480a35df33d999ca056fae7830ea11025.zip
Implement defaultDokkaOutputDirectory
Diffstat (limited to 'runners')
-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.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt2
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/defaultDokkaOutputDirectory.kt13
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt5
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)
}
}