aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2016-12-14 20:23:24 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2016-12-14 20:23:24 +0300
commit08fbbc554b1267d6f7803887ad0d1aa0a796498a (patch)
tree7156318240e5f855942096058e50356ee98e1f34 /runners/gradle-plugin/src/main
parent06407b72685cc2a5fdd0ff42bca2e0eb206a99fd (diff)
downloaddokka-08fbbc554b1267d6f7803887ad0d1aa0a796498a.tar.gz
dokka-08fbbc554b1267d6f7803887ad0d1aa0a796498a.tar.bz2
dokka-08fbbc554b1267d6f7803887ad0d1aa0a796498a.zip
Hotfix 0.9.11, now dokka-android should work properly
Diffstat (limited to 'runners/gradle-plugin/src/main')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/main.kt26
1 files changed, 17 insertions, 9 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt
index f2800335..dbb6efce 100644
--- a/runners/gradle-plugin/src/main/kotlin/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/main.kt
@@ -11,7 +11,9 @@ import org.gradle.api.tasks.*
import org.jetbrains.dokka.DokkaBootstrap
import org.jetbrains.dokka.automagicTypedProxy
import org.jetbrains.dokka.gradle.ClassloaderContainer.fatJarClassLoader
+import org.jetbrains.dokka.gradle.DokkaVersion.version
import java.io.File
+import java.io.InputStream
import java.io.Serializable
import java.net.URLClassLoader
import java.util.*
@@ -19,13 +21,8 @@ import java.util.function.BiConsumer
open class DokkaPlugin : Plugin<Project> {
- val properties = Properties()
-
- init {
- properties.load(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka.properties"))
- }
override fun apply(project: Project) {
- version = properties.getProperty("dokka-version")
+ DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka.properties"))
project.tasks.create("dokka", DokkaTask::class.java).apply {
moduleName = project.name
outputDirectory = File(project.buildDir, "dokka").absolutePath
@@ -33,7 +30,16 @@ open class DokkaPlugin : Plugin<Project> {
}
}
-var version: String? = null
+object DokkaVersion {
+ var version: String? = null
+
+ fun loadFrom(stream: InputStream) {
+ version = Properties().apply {
+ load(stream)
+ }.getProperty("dokka-version")
+ }
+}
+
object ClassloaderContainer {
@JvmField
@@ -89,8 +95,10 @@ open class DokkaTask : DefaultTask() {
val fatjar = if (dokkaFatJar is File)
dokkaFatJar as File
else {
- val dependency = project.buildscript.dependencies.create(dokkaFatJar)
- val configuration = project.buildscript.configurations.detachedConfiguration(dependency)
+ //Searching for buildscript where dependency to dokka plugin was defined
+ val myBuildScript = project.allprojects.map { it.buildscript }.find { it.classLoader == javaClass.classLoader }!!
+ val dependency = myBuildScript.dependencies.create(dokkaFatJar)
+ val configuration = myBuildScript.configurations.detachedConfiguration(dependency)
configuration.description = "Dokka main jar"
configuration.resolve().first()
}