Implement support for new script customizations in command line compiler
refactor and fix internals in many places to make it work add appropriate tests for main-kts case
This commit is contained in:
+12
-10
@@ -35,21 +35,23 @@ open class ScriptCompilationConfiguration(baseConfigurations: Iterable<ScriptCom
|
||||
|
||||
object Default : ScriptCompilationConfiguration()
|
||||
|
||||
/**
|
||||
* 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 withUpdates(body: Builder.() -> Unit = {}): ScriptCompilationConfiguration {
|
||||
val newConfiguration = ScriptCompilationConfiguration(this, body = body)
|
||||
return if (newConfiguration == this) this
|
||||
else newConfiguration
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "ScriptCompilationConfiguration($providedProperties)"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 ScriptCompilationConfiguration?.with(body: ScriptCompilationConfiguration.Builder.() -> Unit): ScriptCompilationConfiguration {
|
||||
val newConfiguration =
|
||||
if (this == null) ScriptCompilationConfiguration(body = body)
|
||||
else ScriptCompilationConfiguration(this, body = body)
|
||||
return if (newConfiguration == this) this else newConfiguration
|
||||
}
|
||||
|
||||
/**
|
||||
* The script type display name
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,18 @@ open class ScriptEvaluationConfiguration(baseEvaluationConfigurations: Iterable<
|
||||
object Default : ScriptEvaluationConfiguration()
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ScriptEvaluationConfiguration?.with(body: ScriptEvaluationConfiguration.Builder.() -> Unit): ScriptEvaluationConfiguration {
|
||||
val newConfiguration =
|
||||
if (this == null) ScriptEvaluationConfiguration(body = body)
|
||||
else ScriptEvaluationConfiguration(this, body = body)
|
||||
return if (newConfiguration != this) newConfiguration else this
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The list of actual script implicit receiver object, in the same order as specified in {@link ScriptCompilationConfigurationKeys#implicitReceivers}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user