Rename JVMPlatform and JSPlatform and make them nested in TargetPlatformKind
To avoid confusion with JvmPlatform and JsPlatform from frontend.java and
js.frontend respectively
Original commit: 26a6ce9a31
This commit is contained in:
@@ -31,8 +31,18 @@ sealed class TargetPlatformKind<out Version : DescriptionAware>(
|
||||
) : DescriptionAware {
|
||||
override val description = "$name ${version.description}"
|
||||
|
||||
class Jvm(version: JvmTarget) : TargetPlatformKind<JvmTarget>(version, "JVM") {
|
||||
companion object {
|
||||
val JVM_PLATFORMS by lazy { JvmTarget.values().map(::Jvm) }
|
||||
|
||||
operator fun get(version: JvmTarget) = JVM_PLATFORMS[version.ordinal]
|
||||
}
|
||||
}
|
||||
|
||||
object JavaScript : TargetPlatformKind<NoVersion>(NoVersion, "JavaScript")
|
||||
|
||||
companion object {
|
||||
val ALL_PLATFORMS: List<TargetPlatformKind<*>> by lazy { JVMPlatform.JVM_PLATFORMS + JSPlatform }
|
||||
val ALL_PLATFORMS: List<TargetPlatformKind<*>> by lazy { Jvm.JVM_PLATFORMS + JavaScript }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,16 +50,6 @@ object NoVersion : DescriptionAware {
|
||||
override val description = ""
|
||||
}
|
||||
|
||||
class JVMPlatform(version: JvmTarget) : TargetPlatformKind<JvmTarget>(version, "JVM") {
|
||||
companion object {
|
||||
val JVM_PLATFORMS by lazy { JvmTarget.values().map(::JVMPlatform) }
|
||||
|
||||
operator fun get(version: JvmTarget) = JVM_PLATFORMS[version.ordinal]
|
||||
}
|
||||
}
|
||||
|
||||
object JSPlatform : TargetPlatformKind<NoVersion>(NoVersion, "JavaScript")
|
||||
|
||||
data class KotlinVersionInfo(
|
||||
var languageLevel: LanguageVersion? = null,
|
||||
var apiLevel: LanguageVersion? = null,
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.copyBean
|
||||
import org.jetbrains.kotlin.config.CompilerSettings
|
||||
import org.jetbrains.kotlin.config.JVMPlatform
|
||||
import org.jetbrains.kotlin.config.TargetPlatformKind
|
||||
import org.jetbrains.kotlin.jps.model.kotlinFacetExtension
|
||||
|
||||
class JpsKotlinCompilerSettings : JpsElementBase<JpsKotlinCompilerSettings>() {
|
||||
@@ -78,7 +78,7 @@ class JpsKotlinCompilerSettings : JpsElementBase<JpsKotlinCompilerSettings>() {
|
||||
fun getK2JvmCompilerArguments(module: JpsModule): K2JVMCompilerArguments {
|
||||
val defaultArguments = getSettings(module.project).k2JvmCompilerArguments
|
||||
val facetSettings = module.kotlinFacetExtension?.settings ?: return defaultArguments
|
||||
val targetPlatform = facetSettings.versionInfo.targetPlatformKind as? JVMPlatform ?: return defaultArguments
|
||||
val targetPlatform = facetSettings.versionInfo.targetPlatformKind as? TargetPlatformKind.Jvm ?: return defaultArguments
|
||||
return copyBean(defaultArguments).apply {
|
||||
jvmTarget = targetPlatform.version.description
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user