Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("unused", "RemoveExplicitTypeArguments")
package kotlin.script.experimental.api
import java.io.File
import java.io.Serializable
import kotlin.reflect.KClass
import kotlin.script.experimental.host.ScriptingHostConfiguration
import kotlin.script.experimental.util.PropertiesCollection
interface ScriptCompilationConfigurationKeys
/**
* The container for script compilation configuration
* For usages see {@link KotlinScript} and actual code examples
*/
open class ScriptCompilationConfiguration(baseConfigurations: Iterable, body: Builder.() -> Unit) :
PropertiesCollection(Builder(baseConfigurations).apply(body).data) {
constructor(body: Builder.() -> Unit = {}) : this(emptyList(), body)
constructor(
vararg baseConfigurations: ScriptCompilationConfiguration, body: Builder.() -> Unit = {}
) : this(baseConfigurations.asIterable(), body)
class Builder internal constructor(baseConfigurations: Iterable) :
ScriptCompilationConfigurationKeys,
PropertiesCollection.Builder(baseConfigurations)
// inherited from script compilationConfiguration for using as a keys anchor
companion object : ScriptCompilationConfigurationKeys
object Default : ScriptCompilationConfiguration()
override fun toString(): String {
return "ScriptCompilationConfiguration($properties)"
}
}
/**
* 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
*/
val ScriptCompilationConfigurationKeys.displayName by PropertiesCollection.key()
/**
* The default script class name
*/
val ScriptCompilationConfigurationKeys.defaultIdentifier by PropertiesCollection.key("Script")
/**
* The script filename extension
* Used for the primary script definition selection as well as to assign a kotlin-specific file type to the files with the extension in Intellij IDEA
* For Intellij IDEA support, it is important to have this extension set to a non-ambiguous name.
* See also {@link ScriptCompilationConfigurationKeys#filePathPattern} parameter for more fine-grained script definition selection
*/
val ScriptCompilationConfigurationKeys.fileExtension by PropertiesCollection.key("kts")
/**
* Additional (to the filename extension) RegEx pattern with that the script file path is checked
* It is used in the hosts that may have several script definitions registered and need to distinguish script file types not only by extension
* The argument passed to the RegEx matcher is equivalent to the File.path, taken relatively from a base path defined by the host
* (usually should be the project root or the current directory)
* See also {@link ScriptCompilationConfigurationKeys#fileExtension} parameter for the primary script definition selection
*/
val ScriptCompilationConfigurationKeys.filePathPattern by PropertiesCollection.key()
/**
* The superclass for target script class
*/
val ScriptCompilationConfigurationKeys.baseClass by PropertiesCollection.key(KotlinType(Any::class)) // script base class
/**
* The list of classes that will be used as implicit receivers in the script body, as if the whole body is wrapped with "with" calls:
*
* {@code
* with (receiver1) {
* ...
* with (receiverN) {
* // script body
* }
* }
* }
*
*
* Note: the actual receivers values should be passed to the constructor of the generated script class
*/
val ScriptCompilationConfigurationKeys.implicitReceivers by PropertiesCollection.key>() // in the order from outer to inner scope
/**
* The map of names to the types
*/
val ScriptCompilationConfigurationKeys.providedProperties by PropertiesCollection.key