aboutsummaryrefslogtreecommitdiff
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
parent06407b72685cc2a5fdd0ff42bca2e0eb206a99fd (diff)
downloaddokka-08fbbc554b1267d6f7803887ad0d1aa0a796498a.tar.gz
dokka-08fbbc554b1267d6f7803887ad0d1aa0a796498a.tar.bz2
dokka-08fbbc554b1267d6f7803887ad0d1aa0a796498a.zip
Hotfix 0.9.11, now dokka-android should work properly
-rw-r--r--runners/android-gradle-plugin/build.gradle12
-rw-r--r--runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt (renamed from runners/android-gradle-plugin/src/main/kotlin/main.kt)2
-rw-r--r--runners/android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties3
-rw-r--r--runners/gradle-plugin/src/main/kotlin/main.kt26
4 files changed, 32 insertions, 11 deletions
diff --git a/runners/android-gradle-plugin/build.gradle b/runners/android-gradle-plugin/build.gradle
index 55bce3f4..afb0fb72 100644
--- a/runners/android-gradle-plugin/build.gradle
+++ b/runners/android-gradle-plugin/build.gradle
@@ -26,13 +26,23 @@ dependencies {
provided gradleApi()
provided localGroovy()
- shadow 'com.android.tools.build:gradle:2.2.0'
+ provided 'com.android.tools.build:gradle:2.2.0'
}
task sourceJar(type: Jar) {
from sourceSets.main.allSource
}
+processResources {
+ eachFile {
+ if (it.name == "org.jetbrains.dokka-android.properties") {
+ it.filter { line ->
+ line.replace("<version>", dokka_version)
+ }
+ }
+ }
+}
+
shadowJar {
baseName = 'dokka-android-gradle-plugin'
classifier = ''
diff --git a/runners/android-gradle-plugin/src/main/kotlin/main.kt b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
index 11040b2a..5ca3066a 100644
--- a/runners/android-gradle-plugin/src/main/kotlin/main.kt
+++ b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt
@@ -16,6 +16,8 @@ open class DokkaAndroidPlugin : Plugin<Project> {
val allVariantsClassPath = mutableSetOf<File>()
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 {
moduleName = project.name
outputDirectory = File(project.buildDir, "dokka").absolutePath
diff --git a/runners/android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties b/runners/android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties
index 03b28d93..b204da7b 100644
--- a/runners/android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties
+++ b/runners/android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties
@@ -1 +1,2 @@
-implementation-class=org.jetbrains.dokka.gradle.DokkaAndroidPlugin \ No newline at end of file
+implementation-class=org.jetbrains.dokka.gradle.DokkaAndroidPlugin
+dokka-version=<version> \ No newline at end of file
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()
}