diff --git a/jps/jps-common/build.gradle.kts b/jps/jps-common/build.gradle.kts index 141db705077..36ebb685122 100644 --- a/jps/jps-common/build.gradle.kts +++ b/jps/jps-common/build.gradle.kts @@ -11,6 +11,7 @@ dependencies { compile(project(":compiler:cli-common")) compile(project(":compiler:frontend.java")) compile(project(":js:js.frontend")) + compile(project(":kotlin-native:kotlin-native-library-reader")) compileOnly(intellijDep()) compileOnly(intellijDep("jps-standalone")) { includeJars("jps-model") } } diff --git a/jps/jps-common/src/org/jetbrains/kotlin/platform/IdePlatformKind.kt b/jps/jps-common/src/org/jetbrains/kotlin/platform/IdePlatformKind.kt index 395db967918..14313b80497 100644 --- a/jps/jps-common/src/org/jetbrains/kotlin/platform/IdePlatformKind.kt +++ b/jps/jps-common/src/org/jetbrains/kotlin/platform/IdePlatformKind.kt @@ -7,11 +7,12 @@ package org.jetbrains.kotlin.platform import com.intellij.openapi.application.ApplicationManager -import org.jetbrains.kotlin.extensions.ApplicationExtensionDescriptor 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.JsIdePlatformKind import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind +import org.jetbrains.kotlin.platform.impl.NativeIdePlatformKind import org.jetbrains.kotlin.resolve.TargetPlatform import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult @@ -39,7 +40,13 @@ abstract class IdePlatformKind> { } // 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 kinds = extension?.getInstances() ?: return@lazy JPS_KINDS diff --git a/jps/jps-common/src/org/jetbrains/kotlin/platform/impl/NativeIdePlatformKind.kt b/jps/jps-common/src/org/jetbrains/kotlin/platform/impl/NativeIdePlatformKind.kt new file mode 100644 index 00000000000..f0ea3b01d34 --- /dev/null +++ b/jps/jps-common/src/org/jetbrains/kotlin/platform/impl/NativeIdePlatformKind.kt @@ -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() { + + override fun platformByCompilerArguments(arguments: CommonCompilerArguments): IdePlatform? { + 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() { + 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() +