Kotlin Facet: Fix facet creation with non-default JVM target

Original commit: 18632c3200
This commit is contained in:
Alexey Sedunov
2017-04-04 21:11:29 +03:00
parent 24eae3367d
commit 55c4221d9f
@@ -132,14 +132,20 @@ class KotlinFacetSettings {
}
}
fun TargetPlatformKind<*>.createCompilerArguments(): CommonCompilerArguments {
return when (this) {
is TargetPlatformKind.Jvm -> {
K2JVMCompilerArguments().apply { jvmTarget = this@createCompilerArguments.version.description }
}
fun TargetPlatformKind<*>.createCompilerArguments(init: CommonCompilerArguments.() -> Unit = {}): CommonCompilerArguments {
val arguments = when (this) {
is TargetPlatformKind.Jvm -> K2JVMCompilerArguments()
is TargetPlatformKind.JavaScript -> K2JSCompilerArguments()
is TargetPlatformKind.Common -> K2MetadataCompilerArguments()
}
arguments.init()
if (arguments is K2JVMCompilerArguments) {
arguments.jvmTarget = this@createCompilerArguments.version.description
}
return arguments
}
interface KotlinFacetSettingsProvider {