Implement base zip cache with tests...

plus some relevant fixes and refactorings
This commit is contained in:
Ilya Chernikov
2019-07-24 18:47:55 +02:00
parent c7eb9e9520
commit 42dde50b6b
6 changed files with 164 additions and 23 deletions
@@ -81,6 +81,8 @@ private fun ScriptCompilationConfiguration.Builder.propertiesFromTemplate(
private val KClass<*>.kotlinScriptAnnotation: KotlinScript
get() = findAnnotation()
?: when (this@kotlinScriptAnnotation.qualifiedName) {
// Any is the default template, so use a default annotation
Any::class.qualifiedName,
// transitions to the new scripting API: substituting annotations for standard templates from script-runtime
"$SCRIPT_RUNTIME_TEMPLATES_PACKAGE.SimpleScriptTemplate",
"$SCRIPT_RUNTIME_TEMPLATES_PACKAGE.ScriptTemplateWithArgs",
@@ -31,6 +31,17 @@ class ScriptingHostConfiguration(baseScriptingConfigurations: Iterable<Scripting
companion object : ScriptingHostConfigurationKeys
}
/**
* An alternative to the constructor with base configuration, which returns a new configuration only if [body] adds anything
* to the original one, otherwise returns original
*/
fun ScriptingHostConfiguration?.with(body: ScriptingHostConfiguration.Builder.() -> Unit): ScriptingHostConfiguration {
val newConfiguration =
if (this == null) ScriptingHostConfiguration(body = body)
else ScriptingHostConfiguration(this, body = body)
return if (newConfiguration != this) newConfiguration else this
}
/**
* The list of all dependencies required for the script base class and refinement callbacks
*/