aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2019-06-05 15:07:22 +0200
committerKamil Doległo <kamilok1965@interia.pl>2019-06-05 15:07:22 +0200
commit7a4aa33a03381a21049c7447f2f70f6959664302 (patch)
tree5b78f8d42f4863466430152c137de61f030f0f16 /runners/gradle-plugin/src/main
parent7a604e0fd57d29fab4d7f84c29611f5796f1ed1a (diff)
downloaddokka-7a4aa33a03381a21049c7447f2f70f6959664302.tar.gz
dokka-7a4aa33a03381a21049c7447f2f70f6959664302.tar.bz2
dokka-7a4aa33a03381a21049c7447f2f70f6959664302.zip
Implement configuration avoidance
Diffstat (limited to 'runners/gradle-plugin/src/main')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt20
1 files changed, 13 insertions, 7 deletions
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 3e65e6d4..209e812b 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
@@ -2,7 +2,7 @@ package org.jetbrains.dokka.gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
-import org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin
+import org.gradle.util.GradleVersion
import java.io.File
import java.io.InputStream
import java.util.*
@@ -15,17 +15,23 @@ open class DokkaPlugin : Plugin<Project> {
override fun apply(project: Project) {
DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka.properties"))
- // TODO: Register instead of create for Gradle >= 4.10
- project.tasks.create("dokka", DokkaTask::class.java).apply {
- moduleName = project.name
- outputDirectory = File(project.buildDir, "dokka").absolutePath
- }
-
val dokkaRuntimeConfiguration = project.configurations.create("dokkaRuntime")
val defaultDokkaRuntimeConfiguration = project.configurations.create("defaultDokkaRuntime")
defaultDokkaRuntimeConfiguration.defaultDependencies{ dependencies -> dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-fatjar:${DokkaVersion.version}")) }
+ if(GradleVersion.current() >= GradleVersion.version("4.10")) {
+ project.tasks.register("dokka", DokkaTask::class.java).configure {
+ it.moduleName = project.name
+ it.outputDirectory = File(project.buildDir, "dokka").absolutePath
+ }
+ } else {
+ project.tasks.create("dokka", DokkaTask::class.java).apply {
+ moduleName = project.name
+ outputDirectory = File(project.buildDir, "dokka").absolutePath
+ }
+ }
+
project.tasks.withType(DokkaTask::class.java) { task ->
val passConfiguration = project.container(GradlePassConfigurationImpl::class.java)
task.multiplatform = passConfiguration