Fix copy-paste from KTS files
#KT-37517 Fixed
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package to
|
||||
|
||||
val relocatedJarContents = configurations.creating {
|
||||
attributes {
|
||||
attribute(USAGE_ATTRIBUTE, JAVA_RUNTIME)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import custom.scriptDefinition.KotlinPlatformType.Companion.attribute
|
||||
|
||||
<selection>
|
||||
val relocatedJarContents = configurations.creating {
|
||||
attributes {
|
||||
attribute(USAGE_ATTRIBUTE, JAVA_RUNTIME)
|
||||
}
|
||||
}</selection>
|
||||
@@ -0,0 +1,2 @@
|
||||
package to
|
||||
<caret>
|
||||
@@ -0,0 +1,58 @@
|
||||
package custom.scriptDefinition
|
||||
|
||||
import kotlin.script.experimental.annotations.KotlinScript
|
||||
import kotlin.script.experimental.jvm.dependenciesFromClassContext
|
||||
import kotlin.script.experimental.jvm.jvm
|
||||
import kotlin.script.experimental.api.*
|
||||
|
||||
@KotlinScript(
|
||||
displayName = "Definition for tests",
|
||||
fileExtension = "kts",
|
||||
compilationConfiguration = TemplateDefinition::class
|
||||
)
|
||||
open class Template(val args: Array<String>)
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
object TemplateDefinition : ScriptCompilationConfiguration(
|
||||
{
|
||||
baseClass(Base::class)
|
||||
jvm {
|
||||
dependenciesFromClassContext(TemplateDefinition::class)
|
||||
}
|
||||
ide {
|
||||
acceptedLocations(ScriptAcceptedLocation.Everywhere)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
data class Attr(val name: String, val clazz: Class<*>)
|
||||
|
||||
class KotlinPlatformType {
|
||||
companion object {
|
||||
val attribute = Attr("org.gradle.usage", Attr::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
class AttributesBuilder {
|
||||
fun attribute(attribute: Attr, name: String) {}
|
||||
}
|
||||
|
||||
class ConfigurationsBuilder {
|
||||
fun attributes(configuration: AttributesBuilder.() -> Unit) {
|
||||
AttributesBuilder().apply(configuration)
|
||||
}
|
||||
}
|
||||
|
||||
class Configurations {
|
||||
fun creating(initializer: ConfigurationsBuilder.() -> Unit) {
|
||||
ConfigurationsBuilder().apply(initializer)
|
||||
}
|
||||
}
|
||||
|
||||
open class Base {
|
||||
val configurations = Configurations()
|
||||
|
||||
val USAGE_ATTRIBUTE = Attr("org.gradle.usage", Attr::class.java)
|
||||
|
||||
val JAVA_RUNTIME = "java-runtime"
|
||||
}
|
||||
Reference in New Issue
Block a user