Skip to content

Commit

Permalink
Remove stack overflow error
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin authored and Kamil Doległo committed Jan 29, 2020
1 parent 56a4849 commit 4e4f28f
Showing 1 changed file with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,9 @@ open class DokkaTask : DefaultTask() {

private var outputDiagnosticInfo: Boolean = false // Workaround for Gradle, which fires some methods (like collectConfigurations()) multiple times in its lifecycle

private fun tryResolveFatJar(configuration: Configuration?, level: Int = 0): Set<File> {
val maxRetries = 10
return try {
configuration!!.resolve()
} catch (e: Exception) {
if (level >= maxRetries)
throw IllegalStateException("Cannot resolve dokka fatjar! Make sure you have jcenter() in your repositories")
project.parent?.let { tryResolveFatJar(configuration, level + 1) } ?: throw e
}
}

private fun loadFatJar() {
if (ClassloaderContainer.fatJarClassLoader == null) {
val jars = tryResolveFatJar(dokkaRuntime).toList()
val jars = dokkaRuntime!!.resolve().toList()
ClassloaderContainer.fatJarClassLoader = URLClassLoader(jars.map { it.toURI().toURL() }.toTypedArray(), ClassLoader.getSystemClassLoader().parent)
}
}
Expand Down

0 comments on commit 4e4f28f

Please sign in to comment.