Kotlin Facet: Reuse JvmTarget and LanguageVersion in facet configuration
Original commit: a2948a624f
This commit is contained in:
@@ -11,5 +11,6 @@
|
||||
<orderEntry type="library" name="kotlin-reflect" level="project" />
|
||||
<orderEntry type="library" name="intellij-core" level="project" />
|
||||
<orderEntry type="module" module-name="cli-common" />
|
||||
<orderEntry type="module" module-name="util" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.config;
|
||||
|
||||
interface DescriptionAware {
|
||||
val description: String
|
||||
}
|
||||
@@ -36,11 +36,7 @@ import com.intellij.util.xmlb.annotations.Property
|
||||
import com.intellij.util.xmlb.annotations.Transient
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
|
||||
enum class LanguageLevel(override val description: String) : DescriptionAware {
|
||||
KOTLIN_1_0("1.0"),
|
||||
KOTLIN_1_1("1.1")
|
||||
}
|
||||
import org.jetbrains.kotlin.utils.DescriptionAware
|
||||
|
||||
sealed class TargetPlatformKind<out Version : DescriptionAware>(
|
||||
val version: Version,
|
||||
@@ -57,24 +53,19 @@ object NoVersion : DescriptionAware {
|
||||
override val description = ""
|
||||
}
|
||||
|
||||
enum class JVMVersion(override val description: String) : DescriptionAware {
|
||||
JVM_1_6("1.6"),
|
||||
JVM_1_8("1.8")
|
||||
}
|
||||
|
||||
class JVMPlatform(version: JVMVersion) : TargetPlatformKind<JVMVersion>(version, "JVM") {
|
||||
class JVMPlatform(version: JvmTarget) : TargetPlatformKind<JvmTarget>(version, "JVM") {
|
||||
companion object {
|
||||
val JVM_PLATFORMS by lazy { JVMVersion.values().map(::JVMPlatform) }
|
||||
val JVM_PLATFORMS by lazy { JvmTarget.values().map(::JVMPlatform) }
|
||||
|
||||
operator fun get(version: JVMVersion) = JVM_PLATFORMS[version.ordinal]
|
||||
operator fun get(version: JvmTarget) = JVM_PLATFORMS[version.ordinal]
|
||||
}
|
||||
}
|
||||
|
||||
object JSPlatform : TargetPlatformKind<NoVersion>(NoVersion, "JavaScript")
|
||||
|
||||
data class KotlinVersionInfo(
|
||||
var languageLevel: LanguageLevel? = null,
|
||||
var apiLevel: LanguageLevel? = null,
|
||||
var languageLevel: LanguageVersion? = null,
|
||||
var apiLevel: LanguageVersion? = null,
|
||||
@get:Transient var targetPlatformKindKind: TargetPlatformKind<*>? = null
|
||||
) {
|
||||
// To be serialized
|
||||
|
||||
Reference in New Issue
Block a user