aboutsummaryrefslogtreecommitdiff
path: root/runners/android-gradle-plugin
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2019-06-06 14:50:13 +0200
committerKamil Doległo <kamilok1965@interia.pl>2019-06-06 14:50:13 +0200
commit993b8fe11d9ca566fdfab997489fcc948182aae5 (patch)
tree12bc586b12f00a695993e3eab523ee4d17abaa3a /runners/android-gradle-plugin
parent5aace9a4633f95a45f9ffd7f1cf8e833e573e489 (diff)
downloaddokka-993b8fe11d9ca566fdfab997489fcc948182aae5.tar.gz
dokka-993b8fe11d9ca566fdfab997489fcc948182aae5.tar.bz2
dokka-993b8fe11d9ca566fdfab997489fcc948182aae5.zip
Fix some bugs
Diffstat (limited to 'runners/android-gradle-plugin')
-rw-r--r--runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt38
1 files changed, 25 insertions, 13 deletions
diff --git a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
index 2d79013e..5646a75f 100644
--- a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
+++ b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
@@ -1,27 +1,39 @@
package org.jetbrains.dokka.gradle
-import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.Input
+import org.gradle.util.GradleVersion
import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink.Builder
import org.jetbrains.dokka.DokkaConfiguration.SourceRoot
import java.io.File
-internal const val CONFIGURATION_EXTENSION_NAME = "configuration"
-internal const val MULTIPLATFORM_EXTENSION_NAME = "multiplatform"
-
-open class DokkaAndroidPlugin : Plugin<Project> {
+open class DokkaAndroidPlugin : DokkaPlugin() {
override fun apply(project: Project) {
- DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties"))
- project.tasks.create("dokka", DokkaAndroidTask::class.java).apply {
- dokkaRuntime = project.configurations.create("dokkaRuntime")
- moduleName = project.name
- outputDirectory = File(project.buildDir, "dokka").absolutePath
+ DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka.properties"))
+
+ 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", DokkaAndroidTask::class.java).configure {
+ it.moduleName = project.name
+ it.outputDirectory = File(project.buildDir, "dokka").absolutePath
+ }
+ } else {
+ project.tasks.create("dokka", DokkaAndroidTask::class.java).apply {
+ moduleName = project.name
+ outputDirectory = File(project.buildDir, "dokka").absolutePath
+ }
}
- project.tasks.withType(DokkaTask::class.java) { task ->
+
+ project.tasks.withType(DokkaAndroidTask::class.java) { task ->
val passConfiguration = project.container(GradlePassConfigurationImpl::class.java)
- task.extensions.add(MULTIPLATFORM_EXTENSION_NAME, passConfiguration)
- task.extensions.create(CONFIGURATION_EXTENSION_NAME, GradlePassConfigurationImpl::class.java, "")
+ task.multiplatform = passConfiguration
+ task.configuration = GradlePassConfigurationImpl()
+ task.dokkaRuntime = dokkaRuntimeConfiguration
+ task.defaultDokkaRuntime = defaultDokkaRuntimeConfiguration
}
}
}