Move NativeIdePlatformKind to idea-jps-common
Issue #KT-26714 Fixed
Original commit: 0c94aefb87
This commit is contained in:
committed by
Sergey Rostov
parent
4cc52c1dff
commit
bc766111a6
@@ -11,6 +11,7 @@ dependencies {
|
|||||||
compile(project(":compiler:cli-common"))
|
compile(project(":compiler:cli-common"))
|
||||||
compile(project(":compiler:frontend.java"))
|
compile(project(":compiler:frontend.java"))
|
||||||
compile(project(":js:js.frontend"))
|
compile(project(":js:js.frontend"))
|
||||||
|
compile(project(":kotlin-native:kotlin-native-library-reader"))
|
||||||
compileOnly(intellijDep())
|
compileOnly(intellijDep())
|
||||||
compileOnly(intellijDep("jps-standalone")) { includeJars("jps-model") }
|
compileOnly(intellijDep("jps-standalone")) { includeJars("jps-model") }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,12 @@
|
|||||||
package org.jetbrains.kotlin.platform
|
package org.jetbrains.kotlin.platform
|
||||||
|
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import org.jetbrains.kotlin.extensions.ApplicationExtensionDescriptor
|
|
||||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||||
|
import org.jetbrains.kotlin.extensions.ApplicationExtensionDescriptor
|
||||||
import org.jetbrains.kotlin.platform.impl.CommonIdePlatformKind
|
import org.jetbrains.kotlin.platform.impl.CommonIdePlatformKind
|
||||||
import org.jetbrains.kotlin.platform.impl.JsIdePlatformKind
|
import org.jetbrains.kotlin.platform.impl.JsIdePlatformKind
|
||||||
import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind
|
import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind
|
||||||
|
import org.jetbrains.kotlin.platform.impl.NativeIdePlatformKind
|
||||||
import org.jetbrains.kotlin.resolve.TargetPlatform
|
import org.jetbrains.kotlin.resolve.TargetPlatform
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
||||||
|
|
||||||
@@ -39,7 +40,13 @@ abstract class IdePlatformKind<Kind : IdePlatformKind<Kind>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For using only in JPS
|
// For using only in JPS
|
||||||
private val JPS_KINDS get() = listOf(JvmIdePlatformKind, JsIdePlatformKind, CommonIdePlatformKind)
|
private val JPS_KINDS
|
||||||
|
get() = listOf(
|
||||||
|
JvmIdePlatformKind,
|
||||||
|
JsIdePlatformKind,
|
||||||
|
CommonIdePlatformKind,
|
||||||
|
NativeIdePlatformKind
|
||||||
|
)
|
||||||
|
|
||||||
val ALL_KINDS by lazy {
|
val ALL_KINDS by lazy {
|
||||||
val kinds = extension?.getInstances() ?: return@lazy JPS_KINDS
|
val kinds = extension?.getInstances() ?: return@lazy JPS_KINDS
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
|
* that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.platform.impl
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||||
|
import org.jetbrains.kotlin.config.TargetPlatformVersion
|
||||||
|
import org.jetbrains.kotlin.platform.IdePlatform
|
||||||
|
import org.jetbrains.kotlin.platform.IdePlatformKind
|
||||||
|
import org.jetbrains.kotlin.resolve.konan.platform.KonanPlatform
|
||||||
|
|
||||||
|
object NativeIdePlatformKind : IdePlatformKind<NativeIdePlatformKind>() {
|
||||||
|
|
||||||
|
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): IdePlatform<NativeIdePlatformKind, CommonCompilerArguments>? {
|
||||||
|
return if (arguments is FakeK2NativeCompilerArguments) Platform
|
||||||
|
else null
|
||||||
|
}
|
||||||
|
|
||||||
|
override val compilerPlatform get() = KonanPlatform
|
||||||
|
|
||||||
|
override val platforms get() = listOf(Platform)
|
||||||
|
override val defaultPlatform get() = Platform
|
||||||
|
|
||||||
|
override val argumentsClass get() = FakeK2NativeCompilerArguments::class.java
|
||||||
|
|
||||||
|
override val name get() = "Native"
|
||||||
|
|
||||||
|
object Platform : IdePlatform<NativeIdePlatformKind, FakeK2NativeCompilerArguments>() {
|
||||||
|
override val kind get() = NativeIdePlatformKind
|
||||||
|
override val version get() = TargetPlatformVersion.NoVersion
|
||||||
|
override fun createArguments(init: FakeK2NativeCompilerArguments.() -> Unit) = FakeK2NativeCompilerArguments().apply(init)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// These are fake compiler arguments for Kotlin/Native - only for usage within IDEA plugin:
|
||||||
|
class FakeK2NativeCompilerArguments : CommonCompilerArguments()
|
||||||
|
|
||||||
Reference in New Issue
Block a user