Add example scripting hosts with tests:

the simple scripting host and the one with maven resolving
This commit is contained in:
Ilya Chernikov
2018-02-05 16:00:59 +01:00
parent c48a74b84a
commit 3732422e6a
14 changed files with 319 additions and 1 deletions
@@ -71,7 +71,7 @@ private fun splitJarUrl(url: String): Pair<String, String>? {
return Pair(jarPath, resourcePath)
}
internal fun getResourcePathForClass(aClass: Class<*>): File {
fun getResourcePathForClass(aClass: Class<*>): File {
val path = "/" + aClass.name.replace('.', '/') + ".class"
val resourceRoot = getResourceRoot(aClass, path) ?: throw IllegalStateException("Resource not found: $path")
return File(resourceRoot).absoluteFile