aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/plugability/DokkaContext.kt13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/src/main/kotlin/plugability/DokkaContext.kt b/core/src/main/kotlin/plugability/DokkaContext.kt
index 7da4d9a7..b54d8ed0 100644
--- a/core/src/main/kotlin/plugability/DokkaContext.kt
+++ b/core/src/main/kotlin/plugability/DokkaContext.kt
@@ -20,8 +20,17 @@ class DokkaContext private constructor() {
fun from(pluginsClasspath: Iterable<File>) = DokkaContext().apply {
pluginsClasspath.map { it.relativeTo(File(".").absoluteFile).toURI().toURL() }
.toTypedArray()
- .let { ServiceLoader.load(DokkaPlugin::class.java, URLClassLoader(it, this.javaClass.classLoader)) }
+ .let { URLClassLoader(it, this.javaClass.classLoader) }
+ .also { checkClasspath(it) }
+ .let { ServiceLoader.load(DokkaPlugin::class.java, it) }
.forEach { install(it) }
}
}
-} \ No newline at end of file
+
+ private fun checkClasspath(classLoader: URLClassLoader) {
+ classLoader.findResource(javaClass.name.replace('.','/') + ".class")?.also {
+ throw AssertionError("Dokka API found on plugins classpath. This will lead to subtle bugs. " +
+ "Please fix your plugins dependencies or exclude dokka api artifact from plugin classpath")
+ }
+ }
+}