From cf4b03f7c6299e401eedc9dc832a06a778105f75 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Wed, 14 Dec 2016 20:56:23 +0300 Subject: Hotfix 0.9.11, finally fixed problem with dokka-fatjar resolving --- runners/gradle-plugin/src/main/kotlin/main.kt | 26 +++++++++++++++----------- 1 file 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) -- cgit