Fix entries closing on saving compiled script to jar:
also adding a short sleep in tests, otherwise in some cases the classloader was not able to find class in the jar. Fixes script to jar saving tests on windows
This commit is contained in:
+3
@@ -112,6 +112,7 @@ class ScriptingHostTest : TestCase() {
|
||||
val compilationConfiguration = createJvmCompilationConfigurationFromTemplate<SimpleScriptTemplate>()
|
||||
val host = BasicJvmScriptingHost(evaluator = BasicJvmScriptJarGenerator(outJar))
|
||||
host.eval("println(\"$greeting\")".toScriptSource(name = "SavedScript.kts"), compilationConfiguration, null).throwOnFailure()
|
||||
Thread.sleep(100)
|
||||
val classloader = URLClassLoader(arrayOf(outJar.toURI().toURL()), ScriptingHostTest::class.java.classLoader)
|
||||
val scriptClass = classloader.loadClass("SavedScript")
|
||||
val output = captureOut {
|
||||
@@ -139,6 +140,8 @@ class ScriptingHostTest : TestCase() {
|
||||
saver(compiledScript, ScriptEvaluationConfiguration.Default).throwOnFailure()
|
||||
}
|
||||
|
||||
Thread.sleep(100)
|
||||
|
||||
val classpathFromJar = run {
|
||||
val manifest = JarFile(outJar).manifest
|
||||
manifest.mainAttributes.getValue("Class-Path").split(" ") // TODO: quoted paths
|
||||
|
||||
Reference in New Issue
Block a user