aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'runners/gradle-plugin/src/main/kotlin')
-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