Implement property for explicit jvmTarget for script definition...
Apply the property to the default JSR-223 script taking the value from java.specification.version property, so effectively implementing jvmTarget detection from current VM. Also drop enforcing of target 1.8, using common default. #KT-49329 fixed #KT-40497 fixed
This commit is contained in:
committed by
TeamCityServer
parent
f0316cde54
commit
1450f4d890
+12
-6
@@ -48,11 +48,8 @@ import kotlin.script.experimental.api.ScriptCompilationConfiguration
|
||||
import kotlin.script.experimental.api.compilerOptions
|
||||
import kotlin.script.experimental.api.dependencies
|
||||
import kotlin.script.experimental.host.ScriptingHostConfiguration
|
||||
import kotlin.script.experimental.jvm.JvmDependency
|
||||
import kotlin.script.experimental.jvm.jdkHome
|
||||
import kotlin.script.experimental.jvm.jvm
|
||||
import kotlin.script.experimental.jvm.*
|
||||
import kotlin.script.experimental.jvm.util.KotlinJars
|
||||
import kotlin.script.experimental.jvm.withUpdatedClasspath
|
||||
|
||||
const val SCRIPT_BASE_COMPILER_ARGUMENTS_PROPERTY = "kotlin.script.base.compiler.arguments"
|
||||
|
||||
@@ -233,8 +230,17 @@ private fun createInitialCompilerConfiguration(
|
||||
|
||||
setupJvmSpecificArguments(baseArguments)
|
||||
|
||||
// Default value differs from the argument's default (see #KT-29405 and #KT-29319)
|
||||
put(JVMConfigurationKeys.JVM_TARGET, JvmTarget.JVM_1_8)
|
||||
val definedTarget = scriptCompilationConfiguration[ScriptCompilationConfiguration.jvm.jvmTarget]
|
||||
if (definedTarget != null) {
|
||||
val target = JvmTarget.values().find { it.description == definedTarget }
|
||||
if (target == null) {
|
||||
messageCollector.report(
|
||||
CompilerMessageSeverity.STRONG_WARNING, "Unknown JVM target \"$definedTarget\", using default"
|
||||
)
|
||||
} else {
|
||||
put(JVMConfigurationKeys.JVM_TARGET, target)
|
||||
}
|
||||
}
|
||||
|
||||
val jdkHomeFromConfigurations = scriptCompilationConfiguration[ScriptCompilationConfiguration.jvm.jdkHome]
|
||||
// TODO: check if this is redundant and/or incorrect since the default is now taken from the host configuration anyway (the one linked to the compilation config)
|
||||
|
||||
Reference in New Issue
Block a user