aboutsummaryrefslogtreecommitdiff
path: root/runners/gradle-plugin/src/main
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2016-12-14 20:56:23 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2016-12-14 20:56:23 +0300
commitcf4b03f7c6299e401eedc9dc832a06a778105f75 (patch)
tree0651814dac9c856566e04d882b8d03a82fb42379 /runners/gradle-plugin/src/main
parent08fbbc554b1267d6f7803887ad0d1aa0a796498a (diff)
downloaddokka-cf4b03f7c6299e401eedc9dc832a06a778105f75.tar.gz
dokka-cf4b03f7c6299e401eedc9dc832a06a778105f75.tar.bz2
dokka-cf4b03f7c6299e401eedc9dc832a06a778105f75.zip
Hotfix 0.9.11, finally fixed problem with dokka-fatjar resolving
Diffstat (limited to 'runners/gradle-plugin/src/main')
-rw-r--r--runners/gradle-plugin/src/main/kotlin/main.kt26
1 files changed, 15 insertions, 11 deletions
diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt
index dbb6efce..e4f4a593 100644
--- a/runners/gradle-plugin/src/main/kotlin/main.kt
+++ b/runners/gradle-plugin/src/main/kotlin/main.kt
@@ -90,19 +90,23 @@ open class DokkaTask : DefaultTask() {
}
+ fun tryResolveFatJar(project: Project): File {
+ return try {
+ val dependency = project.buildscript.dependencies.create(dokkaFatJar)
+ val configuration = project.buildscript.configurations.detachedConfiguration(dependency)
+ configuration.description = "Dokka main jar"
+ configuration.resolve().first()
+ } catch (e: Exception) {
+ project.parent?.let { tryResolveFatJar(it) } ?: throw e
+ }
+ }
+
fun loadFatJar() {
if (fatJarClassLoader == null) {
val fatjar = if (dokkaFatJar is File)
dokkaFatJar as File
- else {
- //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()
- }
-
+ else
+ tryResolveFatJar(project)
fatJarClassLoader = URLClassLoader(arrayOf(fatjar.toURI().toURL()), ClassLoader.getSystemClassLoader().parent)
}
}
@@ -185,8 +189,8 @@ open class DokkaTask : DefaultTask() {
@SkipWhenEmpty
fun getInputFiles(): FileCollection =
project.files(getSourceDirectories().map { project.fileTree(it) }) +
- project.files(includes) +
- project.files(samples.map { project.fileTree(it) })
+ project.files(includes) +
+ project.files(samples.map { project.fileTree(it) })
@OutputDirectory
fun getOutputDirectoryAsFile(): File = project.file(outputDirectory)