Rename platform to targetPlatform in KotlinFacetSettings to avoid ambiguity in Java
This commit is contained in:
+1
-3
@@ -23,8 +23,6 @@ import org.jetbrains.kotlin.idea.facet.KotlinFacetType
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacetType.Companion.ID
|
||||
import org.jetbrains.kotlin.idea.project.platform
|
||||
import org.jetbrains.kotlin.idea.util.rootManager
|
||||
import org.jetbrains.kotlin.platform.impl.CommonIdePlatformKind
|
||||
import org.jetbrains.kotlin.platform.impl.isCommon
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.isCommon
|
||||
|
||||
@@ -40,7 +38,7 @@ val Module.sourceType: SourceType?
|
||||
val Module.isMPPModule: Boolean
|
||||
get() {
|
||||
val settings = facetSettings ?: return false
|
||||
return settings.platform.isCommon() ||
|
||||
return settings.targetPlatform.isCommon() ||
|
||||
settings.implementedModuleNames.isNotEmpty() ||
|
||||
settings.kind.isNewMPP
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ private fun Iterable<String>.addReleaseVersionIfNecessary(shouldAdd: Boolean): I
|
||||
if (shouldAdd) this + VersionView.RELEASED_VERSION.versionString else this
|
||||
|
||||
fun getRuntimeLibraryVersion(module: Module): String? {
|
||||
val targetPlatform = KotlinFacetSettingsProvider.getInstance(module.project).getInitializedSettings(module).platform
|
||||
val targetPlatform = KotlinFacetSettingsProvider.getInstance(module.project).getInitializedSettings(module).targetPlatform
|
||||
val versions = getRuntimeLibraryVersions(module, null, targetPlatform.orDefault().idePlatformKind)
|
||||
return versions.toSet().singleOrNull()
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.intellij.openapi.roots.ProjectFileIndex
|
||||
import com.intellij.openapi.roots.ProjectRootModificationTracker
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.util.CachedValue
|
||||
import com.intellij.psi.util.CachedValueProvider
|
||||
@@ -65,7 +64,7 @@ var KtFile.forcedTargetPlatform: TargetPlatform? by UserDataProperty(Key.create(
|
||||
|
||||
fun Module.getAndCacheLanguageLevelByDependencies(): LanguageVersion {
|
||||
val facetSettings = KotlinFacetSettingsProvider.getInstance(project).getInitializedSettings(this)
|
||||
val languageLevel = getLibraryLanguageLevel(this, null, facetSettings.platform?.idePlatformKind)
|
||||
val languageLevel = getLibraryLanguageLevel(this, null, facetSettings.targetPlatform?.idePlatformKind)
|
||||
|
||||
// Preserve inferred version in facet/project settings
|
||||
if (facetSettings.useProjectSettings) {
|
||||
@@ -197,7 +196,7 @@ private fun Module.computeLanguageVersionSettings(): LanguageVersionSettings {
|
||||
|
||||
val languageFeatures = facetSettings.mergedCompilerArguments?.configureLanguageFeatures(MessageCollector.NONE)?.apply {
|
||||
configureCoroutinesSupport(facetSettings.coroutineSupport, languageVersion)
|
||||
configureMultiplatformSupport(facetSettings.platform?.idePlatformKind, this@computeLanguageVersionSettings)
|
||||
configureMultiplatformSupport(facetSettings.targetPlatform?.idePlatformKind, this@computeLanguageVersionSettings)
|
||||
configureNewInferenceSupportInIDE(project)
|
||||
}.orEmpty()
|
||||
|
||||
@@ -212,7 +211,7 @@ private fun Module.computeLanguageVersionSettings(): LanguageVersionSettings {
|
||||
}
|
||||
|
||||
val Module.platform: TargetPlatform?
|
||||
get() = KotlinFacetSettingsProvider.getInstance(project).getInitializedSettings(this).platform ?: project.platform
|
||||
get() = KotlinFacetSettingsProvider.getInstance(project).getInitializedSettings(this).targetPlatform ?: project.platform
|
||||
|
||||
// FIXME(dsavvinov): this logic is clearly wrong in MPP environment; review and fix
|
||||
val Project.platform: TargetPlatform?
|
||||
|
||||
+2
-2
@@ -303,7 +303,7 @@ class KotlinMPPGradleProjectTaskRunner extends ProjectTaskRunner
|
||||
final KotlinFacet kotlinFacet = KotlinFacet.Companion.get(module);
|
||||
if (kotlinFacet == null) return false;
|
||||
|
||||
final TargetPlatform platform = kotlinFacet.getConfiguration().getSettings().getPlatform();
|
||||
final TargetPlatform platform = kotlinFacet.getConfiguration().getSettings().getTargetPlatform();
|
||||
if (platform == null) return false;
|
||||
|
||||
return KonanPlatformKt.isNative(platform);
|
||||
@@ -316,7 +316,7 @@ class KotlinMPPGradleProjectTaskRunner extends ProjectTaskRunner
|
||||
final KotlinFacetSettings facetSettings = kotlinFacet.getConfiguration().getSettings();
|
||||
if (facetSettings.isTestModule()) return false;
|
||||
|
||||
final TargetPlatform platform = facetSettings.getPlatform();
|
||||
final TargetPlatform platform = facetSettings.getTargetPlatform();
|
||||
if (platform == null) return false;
|
||||
|
||||
return TargetPlatformKt.isCommon(platform);
|
||||
|
||||
+1
-2
@@ -12,7 +12,6 @@ import com.intellij.openapi.externalSystem.util.ExternalSystemUtil
|
||||
import com.intellij.openapi.module.Module
|
||||
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinTargetData
|
||||
import org.jetbrains.kotlin.platform.impl.isCommon
|
||||
import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.GradleTestTasksProvider
|
||||
import org.jetbrains.plugins.gradle.service.project.GradleProjectResolverUtil
|
||||
@@ -52,7 +51,7 @@ class KotlinMPPGradleTestTasksProvider : GradleTestTasksProvider {
|
||||
|
||||
private fun isTestCommonModule(module: Module): Boolean {
|
||||
val settings = KotlinFacetSettingsProvider.getInstance(module.project).getInitializedSettings(module)
|
||||
return settings.platform.isCommon() && settings.isTestModule
|
||||
return settings.targetPlatform.isCommon() && settings.isTestModule
|
||||
}
|
||||
|
||||
private fun getTaskNames(task: TaskData, namePrefix: String): List<String> {
|
||||
|
||||
+23
-23
@@ -103,7 +103,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion)
|
||||
Assert.assertEquals(JvmPlatforms.jvm18, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm18, targetPlatform)
|
||||
Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals(
|
||||
"-Xdump-declarations-to=tmp -Xsingle-module",
|
||||
@@ -115,7 +115,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
Assert.assertEquals("1.0", apiLevel!!.versionString)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform)
|
||||
Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals(
|
||||
"-Xdump-declarations-to=tmpTest",
|
||||
@@ -159,7 +159,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertEquals(JvmPlatforms.jvm18, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm18, targetPlatform)
|
||||
Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals(
|
||||
"-Xdump-declarations-to=tmp -Xsingle-module",
|
||||
@@ -169,7 +169,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(testFacetSettings) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.0", apiLevel!!.versionString)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform)
|
||||
Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals(
|
||||
"-Xdump-declarations-to=tmpTest",
|
||||
@@ -203,7 +203,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings("project_myMain")) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertEquals(JvmPlatforms.jvm18, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm18, targetPlatform)
|
||||
Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals(
|
||||
"-Xdump-declarations-to=tmp -Xsingle-module",
|
||||
@@ -213,7 +213,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings("project_myTest")) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.0", apiLevel!!.versionString)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform)
|
||||
Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals(
|
||||
"-Xdump-declarations-to=tmpTest",
|
||||
@@ -249,7 +249,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings("project_myMain")) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertEquals(JvmPlatforms.jvm18, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm18, targetPlatform)
|
||||
Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals(
|
||||
"-Xdump-declarations-to=tmp -Xsingle-module",
|
||||
@@ -259,7 +259,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings("project_myTest")) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.0", apiLevel!!.versionString)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform)
|
||||
Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals(
|
||||
"-Xdump-declarations-to=tmpTest",
|
||||
@@ -315,7 +315,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion)
|
||||
Assert.assertTrue(platform.isJs())
|
||||
Assert.assertTrue(targetPlatform.isJs())
|
||||
with(compilerArguments as K2JSCompilerArguments) {
|
||||
Assert.assertEquals(true, sourceMap)
|
||||
Assert.assertEquals("plain", moduleKind)
|
||||
@@ -331,7 +331,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
Assert.assertEquals("1.0", apiLevel!!.versionString)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion)
|
||||
Assert.assertTrue(platform.isJs())
|
||||
Assert.assertTrue(targetPlatform.isJs())
|
||||
with(compilerArguments as K2JSCompilerArguments) {
|
||||
Assert.assertEquals(false, sourceMap)
|
||||
Assert.assertEquals("umd", moduleKind)
|
||||
@@ -377,7 +377,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertTrue(platform.isJs())
|
||||
Assert.assertTrue(targetPlatform.isJs())
|
||||
}
|
||||
|
||||
val rootManager = ModuleRootManager.getInstance(getModule("project_main"))
|
||||
@@ -415,7 +415,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings("project_myMain")) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertTrue(platform.isJs())
|
||||
Assert.assertTrue(targetPlatform.isJs())
|
||||
with(compilerArguments as K2JSCompilerArguments) {
|
||||
Assert.assertEquals(true, sourceMap)
|
||||
Assert.assertEquals("plain", moduleKind)
|
||||
@@ -429,7 +429,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings("project_myTest")) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.0", apiLevel!!.versionString)
|
||||
Assert.assertTrue(platform.isJs())
|
||||
Assert.assertTrue(targetPlatform.isJs())
|
||||
with(compilerArguments as K2JSCompilerArguments) {
|
||||
Assert.assertEquals(false, sourceMap)
|
||||
Assert.assertEquals("umd", moduleKind)
|
||||
@@ -466,7 +466,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
importProject()
|
||||
|
||||
with(facetSettings) {
|
||||
Assert.assertTrue(platform.isJs())
|
||||
Assert.assertTrue(targetPlatform.isJs())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform)
|
||||
}
|
||||
|
||||
Assert.assertEquals(
|
||||
@@ -507,7 +507,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertTrue(platform.isJs())
|
||||
Assert.assertTrue(targetPlatform.isJs())
|
||||
}
|
||||
|
||||
val rootManager = ModuleRootManager.getInstance(getModule("project_main"))
|
||||
@@ -541,7 +541,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertTrue(platform.isCommon())
|
||||
Assert.assertTrue(targetPlatform.isCommon())
|
||||
}
|
||||
|
||||
val rootManager = ModuleRootManager.getInstance(getModule("project_main"))
|
||||
@@ -574,7 +574,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings("project")) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertTrue(platform.isCommon())
|
||||
Assert.assertTrue(targetPlatform.isCommon())
|
||||
}
|
||||
|
||||
val rootManager = ModuleRootManager.getInstance(getModule("project"))
|
||||
@@ -602,7 +602,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform)
|
||||
}
|
||||
|
||||
Assert.assertEquals(
|
||||
@@ -631,7 +631,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
with(facetSettings) {
|
||||
Assert.assertEquals("1.1", languageLevel!!.versionString)
|
||||
Assert.assertEquals("1.1", apiLevel!!.versionString)
|
||||
Assert.assertTrue(platform.isJs())
|
||||
Assert.assertTrue(targetPlatform.isJs())
|
||||
}
|
||||
|
||||
Assert.assertEquals(
|
||||
@@ -720,7 +720,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
importProject()
|
||||
|
||||
with(facetSettings("js-module")) {
|
||||
Assert.assertTrue(platform.isJs())
|
||||
Assert.assertTrue(targetPlatform.isJs())
|
||||
}
|
||||
|
||||
val rootManager = ModuleRootManager.getInstance(getModule("js-module"))
|
||||
@@ -870,7 +870,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
Assert.assertEquals("1.0", apiLevel!!.versionString)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion)
|
||||
Assert.assertTrue(platform.isCommon())
|
||||
Assert.assertTrue(targetPlatform.isCommon())
|
||||
Assert.assertEquals("my/classpath", (compilerArguments as K2MetadataCompilerArguments).classpath)
|
||||
Assert.assertEquals("my/destination", (compilerArguments as K2MetadataCompilerArguments).destination)
|
||||
}
|
||||
@@ -880,7 +880,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
Assert.assertEquals("1.0", apiLevel!!.versionString)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion)
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion)
|
||||
Assert.assertTrue(platform.isCommon())
|
||||
Assert.assertTrue(targetPlatform.isCommon())
|
||||
Assert.assertEquals("my/test/classpath", (compilerArguments as K2MetadataCompilerArguments).classpath)
|
||||
Assert.assertEquals("my/test/destination", (compilerArguments as K2MetadataCompilerArguments).destination)
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class KotlinFacetSettings {
|
||||
compilerArguments!!.apiVersion = value?.versionString
|
||||
}
|
||||
|
||||
val platform: TargetPlatform?
|
||||
val targetPlatform: TargetPlatform?
|
||||
get() {
|
||||
val compilerArguments = this.compilerArguments ?: return null
|
||||
return IdePlatformKind.platformByCompilerArguments(compilerArguments)
|
||||
@@ -202,7 +202,7 @@ class KotlinFacetSettings {
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
fun getPlatform(): org.jetbrains.kotlin.platform.IdePlatform<*, *>? {
|
||||
return platform?.toIdePlatform()
|
||||
return targetPlatform?.toIdePlatform()
|
||||
}
|
||||
|
||||
var coroutineSupport: LanguageFeature.State?
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatform
|
||||
import org.jetbrains.kotlin.platform.konan.KonanPlatform
|
||||
import org.jetbrains.kotlin.platform.oldFashionedDescription
|
||||
import org.jetbrains.kotlin.platform.orDefault
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import java.lang.reflect.Modifier
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.full.superclasses
|
||||
@@ -288,7 +287,7 @@ private fun buildChildElement(element: Element, tag: String, bean: Any, filter:
|
||||
private fun KotlinFacetSettings.writeLatestConfig(element: Element) {
|
||||
val filter = SkipDefaultsSerializationFilter()
|
||||
|
||||
platform?.let {
|
||||
targetPlatform?.let {
|
||||
element.setAttribute("platform", it.oldFashionedDescription)
|
||||
}
|
||||
if (!useProjectSettings) {
|
||||
|
||||
@@ -257,7 +257,7 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
||||
|
||||
kotlinFacet.configureFacet(compilerVersion, LanguageFeature.Coroutines.defaultState, platform, modifiableModelsProvider)
|
||||
val facetSettings = kotlinFacet.configuration.settings
|
||||
val configuredPlatform = kotlinFacet.configuration.settings.platform!!
|
||||
val configuredPlatform = kotlinFacet.configuration.settings.targetPlatform!!
|
||||
val configuration = mavenPlugin.configurationElement
|
||||
val sharedArguments = getCompilerArgumentsByConfigurationElement(mavenProject, configuration, configuredPlatform)
|
||||
val executionArguments = mavenPlugin.executions
|
||||
@@ -370,7 +370,7 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
||||
}.distinct()
|
||||
|
||||
private fun setImplementedModuleName(kotlinFacet: KotlinFacet, mavenProject: MavenProject, module: Module) {
|
||||
if (kotlinFacet.configuration.settings.platform.isCommon()) {
|
||||
if (kotlinFacet.configuration.settings.targetPlatform.isCommon()) {
|
||||
kotlinFacet.configuration.settings.implementedModuleNames = emptyList()
|
||||
} else {
|
||||
val manager = MavenProjectsManager.getInstance(module.project)
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.intellij.openapi.roots.CompilerModuleExtension
|
||||
import com.intellij.openapi.roots.LibraryOrderEntry
|
||||
import com.intellij.openapi.roots.ModuleRootManager
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryEx
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager
|
||||
import com.intellij.util.PathUtil
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.jps.model.java.JavaResourceRootType
|
||||
@@ -46,9 +45,7 @@ import org.jetbrains.kotlin.idea.framework.JSLibraryKind
|
||||
import org.jetbrains.kotlin.idea.framework.KotlinSdkType
|
||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.refactoring.toPsiFile
|
||||
import org.jetbrains.kotlin.platform.impl.*
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners
|
||||
import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner
|
||||
import org.jetbrains.kotlin.platform.CommonPlatforms
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
@@ -639,7 +636,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion)
|
||||
Assert.assertEquals(true, compilerArguments!!.suppressWarnings)
|
||||
Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport)
|
||||
Assert.assertEquals("JVM 1.8", platform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("JVM 1.8", targetPlatform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals("foobar.jar", (compilerArguments as K2JVMCompilerArguments).classpath)
|
||||
Assert.assertEquals(
|
||||
@@ -760,7 +757,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
Assert.assertEquals("1.0", compilerArguments!!.languageVersion)
|
||||
Assert.assertEquals("1.0", apiLevel!!.versionString)
|
||||
Assert.assertEquals("1.0", compilerArguments!!.apiVersion)
|
||||
Assert.assertEquals("JVM 1.8", platform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("JVM 1.8", targetPlatform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
}
|
||||
|
||||
@@ -835,7 +832,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion)
|
||||
Assert.assertEquals(true, compilerArguments!!.suppressWarnings)
|
||||
Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport)
|
||||
Assert.assertTrue(platform.isJs())
|
||||
Assert.assertTrue(targetPlatform.isJs())
|
||||
with(compilerArguments as K2JSCompilerArguments) {
|
||||
Assert.assertEquals(true, sourceMap)
|
||||
Assert.assertEquals("commonjs", moduleKind)
|
||||
@@ -990,7 +987,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
Assert.assertEquals("1.0", compilerArguments!!.apiVersion)
|
||||
Assert.assertEquals(true, compilerArguments!!.suppressWarnings)
|
||||
Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport)
|
||||
Assert.assertEquals("JVM 1.8", platform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("JVM 1.8", targetPlatform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals("foobar.jar", (compilerArguments as K2JVMCompilerArguments).classpath)
|
||||
Assert.assertEquals("-version", compilerSettings!!.additionalArguments)
|
||||
@@ -1050,7 +1047,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertImporterStatePresent()
|
||||
|
||||
with(facetSettings) {
|
||||
Assert.assertEquals("JVM 1.8", platform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("JVM 1.8", targetPlatform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport)
|
||||
Assert.assertEquals("c:/program files/jdk1.8", (compilerArguments as K2JVMCompilerArguments).classpath)
|
||||
@@ -1106,7 +1103,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertImporterStatePresent()
|
||||
|
||||
with(facetSettings) {
|
||||
Assert.assertEquals("JVM 1.8", platform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("JVM 1.8", targetPlatform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport)
|
||||
Assert.assertEquals("c:/program files/jdk1.8", (compilerArguments as K2JVMCompilerArguments).classpath)
|
||||
@@ -1160,7 +1157,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, facetSettings.platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, facetSettings.targetPlatform)
|
||||
|
||||
assertContentFolders("project", JavaSourceRootType.SOURCE, "src/main/kotlin")
|
||||
assertContentFolders("project", JavaSourceRootType.TEST_SOURCE, "src/test/java")
|
||||
@@ -1215,7 +1212,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, facetSettings.platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, facetSettings.targetPlatform)
|
||||
}
|
||||
|
||||
fun testJvmDetectionByGoalWithCommonStdlib() {
|
||||
@@ -1265,7 +1262,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, facetSettings.platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, facetSettings.targetPlatform)
|
||||
|
||||
assertContentFolders("project", JavaSourceRootType.SOURCE, "src/main/kotlin")
|
||||
assertContentFolders("project", JavaSourceRootType.TEST_SOURCE, "src/test/java")
|
||||
@@ -1320,7 +1317,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertTrue(facetSettings.platform.isJs())
|
||||
Assert.assertTrue(facetSettings.targetPlatform.isJs())
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
|
||||
@@ -1377,7 +1374,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertTrue(facetSettings.platform.isJs())
|
||||
Assert.assertTrue(facetSettings.targetPlatform.isJs())
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
|
||||
@@ -1434,7 +1431,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertTrue(facetSettings.platform.isJs())
|
||||
Assert.assertTrue(facetSettings.targetPlatform.isJs())
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
|
||||
@@ -1496,7 +1493,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertTrue(facetSettings.platform.isJs())
|
||||
Assert.assertTrue(facetSettings.targetPlatform.isJs())
|
||||
|
||||
val rootManager = ModuleRootManager.getInstance(getModule("project"))
|
||||
val libraries = rootManager.orderEntries.filterIsInstance<LibraryOrderEntry>().map { it.library as LibraryEx }
|
||||
@@ -1550,7 +1547,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertTrue(facetSettings.platform.isCommon())
|
||||
Assert.assertTrue(facetSettings.targetPlatform.isCommon())
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
|
||||
@@ -1601,7 +1598,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertTrue(facetSettings.platform.isCommon())
|
||||
Assert.assertTrue(facetSettings.targetPlatform.isCommon())
|
||||
|
||||
Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType)
|
||||
|
||||
@@ -1652,7 +1649,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertTrue(facetSettings.platform.isCommon())
|
||||
Assert.assertTrue(facetSettings.targetPlatform.isCommon())
|
||||
|
||||
val rootManager = ModuleRootManager.getInstance(getModule("project"))
|
||||
val stdlib = rootManager.orderEntries.filterIsInstance<LibraryOrderEntry>().single().library
|
||||
@@ -1713,7 +1710,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, facetSettings.platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, facetSettings.targetPlatform)
|
||||
|
||||
assertContentFolders("project", SourceKotlinRootType, "src/main/kotlin")
|
||||
assertContentFolders("project", TestSourceKotlinRootType, "src/test/java")
|
||||
@@ -1768,7 +1765,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertTrue(facetSettings.platform.isJs())
|
||||
Assert.assertTrue(facetSettings.targetPlatform.isJs())
|
||||
|
||||
assertContentFolders("project", SourceKotlinRootType, "src/main/kotlin")
|
||||
assertContentFolders("project", TestSourceKotlinRootType, "src/test/java")
|
||||
@@ -1823,7 +1820,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertModules("project")
|
||||
assertImporterStatePresent()
|
||||
|
||||
Assert.assertTrue(facetSettings.platform.isCommon())
|
||||
Assert.assertTrue(facetSettings.targetPlatform.isCommon())
|
||||
|
||||
assertContentFolders("project", SourceKotlinRootType, "src/main/kotlin")
|
||||
assertContentFolders("project", TestSourceKotlinRootType, "src/test/java")
|
||||
@@ -2037,7 +2034,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertImporterStatePresent()
|
||||
|
||||
with(facetSettings) {
|
||||
Assert.assertEquals("JVM 1.8", platform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("JVM 1.8", targetPlatform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("1.1", languageLevel!!.description)
|
||||
Assert.assertEquals("1.1", apiLevel!!.description)
|
||||
Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
@@ -2260,7 +2257,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertImporterStatePresent()
|
||||
|
||||
with(facetSettings("myModule1")) {
|
||||
Assert.assertEquals("JVM 1.8", platform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("JVM 1.8", targetPlatform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("1.1", languageLevel!!.description)
|
||||
Assert.assertEquals("1.0", apiLevel!!.description)
|
||||
Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
@@ -2271,7 +2268,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
}
|
||||
|
||||
with(facetSettings("myModule2")) {
|
||||
Assert.assertEquals("JVM 1.8", platform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("JVM 1.8", targetPlatform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("1.1", languageLevel!!.description)
|
||||
Assert.assertEquals("1.0", apiLevel!!.description)
|
||||
Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
@@ -2282,7 +2279,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
}
|
||||
|
||||
with(facetSettings("myModule3")) {
|
||||
Assert.assertEquals("JVM 1.8", platform!!.oldFashionedDescription)
|
||||
Assert.assertEquals("JVM 1.8", targetPlatform!!.oldFashionedDescription)
|
||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, languageLevel)
|
||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, apiLevel)
|
||||
Assert.assertEquals("1.8", (compilerArguments as K2JVMCompilerArguments).jvmTarget)
|
||||
@@ -2521,20 +2518,20 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
assertImporterStatePresent()
|
||||
|
||||
with(facetSettings("my-common-module1")) {
|
||||
Assert.assertEquals(CommonPlatforms.defaultCommonPlatform, platform)
|
||||
Assert.assertEquals(CommonPlatforms.defaultCommonPlatform, targetPlatform)
|
||||
}
|
||||
|
||||
with(facetSettings("my-common-module2")) {
|
||||
Assert.assertEquals(CommonPlatforms.defaultCommonPlatform, platform)
|
||||
Assert.assertEquals(CommonPlatforms.defaultCommonPlatform, targetPlatform)
|
||||
}
|
||||
|
||||
with(facetSettings("my-jvm-module")) {
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, platform)
|
||||
Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform)
|
||||
Assert.assertEquals(listOf("my-common-module1", "my-common-module2"), implementedModuleNames)
|
||||
}
|
||||
|
||||
with(facetSettings("my-js-module")) {
|
||||
Assert.assertEquals(JsPlatforms.defaultJsPlatform, platform)
|
||||
Assert.assertEquals(JsPlatforms.defaultJsPlatform, targetPlatform)
|
||||
Assert.assertEquals(listOf("my-common-module1"), implementedModuleNames)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,6 @@ import org.jetbrains.kotlin.idea.compiler.configuration.*
|
||||
import org.jetbrains.kotlin.idea.util.onTextChange
|
||||
import org.jetbrains.kotlin.platform.IdePlatformKind
|
||||
import org.jetbrains.kotlin.platform.idePlatformKind
|
||||
import org.jetbrains.kotlin.platform.impl.isCommon
|
||||
import org.jetbrains.kotlin.platform.impl.isJavaScript
|
||||
import org.jetbrains.kotlin.platform.impl.isJvm
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
@@ -288,7 +285,7 @@ class KotlinFacetEditorGeneralTab(
|
||||
override fun isModified(): Boolean {
|
||||
if (!isInitialized) return false
|
||||
if (editor.useProjectSettingsCheckBox.isSelected != configuration.settings.useProjectSettings) return true
|
||||
if (editor.chosenPlatform != configuration.settings.platform) return true
|
||||
if (editor.chosenPlatform != configuration.settings.targetPlatform) return true
|
||||
return !editor.useProjectSettingsCheckBox.isSelected && editor.compilerConfigurable.isModified
|
||||
}
|
||||
|
||||
@@ -296,7 +293,7 @@ class KotlinFacetEditorGeneralTab(
|
||||
if (!isInitialized) return
|
||||
validateOnce {
|
||||
editor.useProjectSettingsCheckBox.isSelected = configuration.settings.useProjectSettings
|
||||
editor.targetPlatformComboBox.selectedItem = configuration.settings.platform
|
||||
editor.targetPlatformComboBox.selectedItem = configuration.settings.targetPlatform
|
||||
editor.compilerConfigurable.reset()
|
||||
editor.updateCompilerConfigurable()
|
||||
}
|
||||
@@ -309,7 +306,7 @@ class KotlinFacetEditorGeneralTab(
|
||||
with(configuration.settings) {
|
||||
useProjectSettings = editor.useProjectSettingsCheckBox.isSelected
|
||||
editor.chosenPlatform?.let {
|
||||
if (it != platform) {
|
||||
if (it != targetPlatform) {
|
||||
val platformArguments = when {
|
||||
it.isJvm() -> editor.compilerConfigurable.k2jvmCompilerArguments
|
||||
it.isJs() -> editor.compilerConfigurable.k2jsCompilerArguments
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.jetbrains.kotlin.idea.platform.tooling
|
||||
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
||||
import org.jetbrains.kotlin.platform.*
|
||||
import org.jetbrains.kotlin.platform.compat.toNewPlatform
|
||||
import org.jetbrains.kotlin.platform.compat.toOldPlatform
|
||||
import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind
|
||||
import org.jetbrains.kotlin.psi.NotNullableUserDataProperty
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
@@ -106,7 +105,7 @@ fun KotlinFacetSettings.initializeIfNeeded(
|
||||
getLibraryLanguageLevel(
|
||||
module,
|
||||
rootModel,
|
||||
this.platform?.idePlatformKind,
|
||||
this.targetPlatform?.idePlatformKind,
|
||||
coerceRuntimeLibraryVersionToReleased = compilerVersion == null
|
||||
)
|
||||
)
|
||||
|
||||
@@ -208,7 +208,7 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
assertEquals(false, settings.getUseProjectSettings());
|
||||
assertEquals("1.1", settings.getLanguageLevel().getDescription());
|
||||
assertEquals("1.0", settings.getApiLevel().getDescription());
|
||||
assertEquals(JvmPlatforms.INSTANCE.getJvm18(), settings.getPlatform());
|
||||
assertEquals(JvmPlatforms.INSTANCE.getJvm18(), settings.getTargetPlatform());
|
||||
assertEquals("1.1", arguments.getLanguageVersion());
|
||||
assertEquals("1.0", arguments.getApiVersion());
|
||||
assertEquals(LanguageFeature.State.ENABLED_WITH_WARNING, CoroutineSupport.byCompilerArguments(arguments));
|
||||
@@ -223,7 +223,7 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
assertEquals(false, settings.getUseProjectSettings());
|
||||
assertEquals("1.1", settings.getLanguageLevel().getDescription());
|
||||
assertEquals("1.0", settings.getApiLevel().getDescription());
|
||||
assertEquals(JsPlatforms.INSTANCE.getDefaultJsPlatform(), settings.getPlatform());
|
||||
assertEquals(JsPlatforms.INSTANCE.getDefaultJsPlatform(), settings.getTargetPlatform());
|
||||
assertEquals("1.1", arguments.getLanguageVersion());
|
||||
assertEquals("1.0", arguments.getApiVersion());
|
||||
assertEquals(LanguageFeature.State.ENABLED_WITH_WARNING, CoroutineSupport.byCompilerArguments(arguments));
|
||||
@@ -238,7 +238,7 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
assertEquals(false, settings.getUseProjectSettings());
|
||||
assertEquals("1.1", settings.getLanguageLevel().getDescription());
|
||||
assertEquals("1.0", settings.getApiLevel().getDescription());
|
||||
assertEquals(JvmPlatforms.INSTANCE.getJvm18(), settings.getPlatform());
|
||||
assertEquals(JvmPlatforms.INSTANCE.getJvm18(), settings.getTargetPlatform());
|
||||
assertEquals("1.1", arguments.getLanguageVersion());
|
||||
assertEquals("1.0", arguments.getApiVersion());
|
||||
assertEquals(LanguageFeature.State.ENABLED, CoroutineSupport.byCompilerArguments(arguments));
|
||||
@@ -253,7 +253,7 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
assertEquals(false, settings.getUseProjectSettings());
|
||||
assertEquals("1.1", settings.getLanguageLevel().getDescription());
|
||||
assertEquals("1.0", settings.getApiLevel().getDescription());
|
||||
assertEquals(JsPlatforms.INSTANCE.getDefaultJsPlatform(), settings.getPlatform());
|
||||
assertEquals(JsPlatforms.INSTANCE.getDefaultJsPlatform(), settings.getTargetPlatform());
|
||||
assertEquals("1.1", arguments.getLanguageVersion());
|
||||
assertEquals("1.0", arguments.getApiVersion());
|
||||
assertEquals(LanguageFeature.State.ENABLED_WITH_ERROR, CoroutineSupport.byCompilerArguments(arguments));
|
||||
@@ -268,7 +268,7 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
assertEquals(false, settings.getUseProjectSettings());
|
||||
assertEquals("1.1", settings.getLanguageLevel().getDescription());
|
||||
assertEquals("1.0", settings.getApiLevel().getDescription());
|
||||
assertEquals(JvmPlatforms.INSTANCE.getJvm18(), settings.getPlatform());
|
||||
assertEquals(JvmPlatforms.INSTANCE.getJvm18(), settings.getTargetPlatform());
|
||||
assertEquals("1.1", arguments.getLanguageVersion());
|
||||
assertEquals("1.0", arguments.getApiVersion());
|
||||
assertEquals(LanguageFeature.State.ENABLED, CoroutineSupport.byCompilerArguments(arguments));
|
||||
@@ -278,7 +278,7 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
|
||||
public void testJvmProjectWithJvmTarget11() {
|
||||
KotlinFacetSettings settings = KotlinFacetSettingsProvider.Companion.getInstance(myProject).getInitializedSettings(getModule());
|
||||
assertEquals(JvmPlatforms.INSTANCE.jvmPlatformByTargetVersion(JvmTarget.JVM_11), settings.getPlatform());
|
||||
assertEquals(JvmPlatforms.INSTANCE.jvmPlatformByTargetVersion(JvmTarget.JVM_11), settings.getTargetPlatform());
|
||||
}
|
||||
|
||||
public void testImplementsDependency() {
|
||||
@@ -352,7 +352,7 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
platform,
|
||||
modelsProvider
|
||||
);
|
||||
assertEquals(platform, facet.getConfiguration().getSettings().getPlatform());
|
||||
assertEquals(platform, facet.getConfiguration().getSettings().getTargetPlatform());
|
||||
assertEquals(jvmTarget.getDescription(),
|
||||
((K2JVMCompilerArguments) facet.getConfiguration().getSettings().getCompilerArguments()).getJvmTarget());
|
||||
}
|
||||
|
||||
+1
-1
@@ -469,7 +469,7 @@ abstract class AbstractIncrementalJpsTest(
|
||||
|
||||
private fun configureRequiredLibraries() {
|
||||
myProject.modules.forEach { module ->
|
||||
val platformKind = module.kotlinFacet?.settings?.platform?.idePlatformKind.orDefault()
|
||||
val platformKind = module.kotlinFacet?.settings?.targetPlatform?.idePlatformKind.orDefault()
|
||||
|
||||
when {
|
||||
platformKind.isJvm -> {
|
||||
|
||||
+2
-4
@@ -16,8 +16,6 @@ import org.jetbrains.kotlin.config.KotlinModuleKind.COMPILATION_AND_SOURCE_SET_H
|
||||
import org.jetbrains.kotlin.config.KotlinModuleKind.SOURCE_SET_HOLDER
|
||||
import org.jetbrains.kotlin.jps.build.dependeciestxt.ModulesTxt.Dependency.Kind.*
|
||||
import org.jetbrains.kotlin.platform.impl.FakeK2NativeCompilerArguments
|
||||
import org.jetbrains.kotlin.platform.impl.isCommon
|
||||
import org.jetbrains.kotlin.platform.impl.isJvm
|
||||
import org.jetbrains.kotlin.platform.isCommon
|
||||
import org.jetbrains.kotlin.platform.jvm.isJvm
|
||||
import java.io.File
|
||||
@@ -54,11 +52,11 @@ data class ModulesTxt(
|
||||
|
||||
val isCommonModule
|
||||
get() =
|
||||
kotlinFacetSettings?.platform.isCommon() ||
|
||||
kotlinFacetSettings?.targetPlatform.isCommon() ||
|
||||
kotlinFacetSettings?.kind == SOURCE_SET_HOLDER
|
||||
|
||||
val isJvmModule
|
||||
get() = kotlinFacetSettings?.platform.isJvm()
|
||||
get() = kotlinFacetSettings?.targetPlatform.isJvm()
|
||||
|
||||
val expectedBy
|
||||
get() = dependencies.filter {
|
||||
|
||||
@@ -17,7 +17,7 @@ val JpsModule.kotlinFacet: JpsKotlinFacetModuleExtension?
|
||||
get() = container.getChild(JpsKotlinFacetModuleExtension.KIND)
|
||||
|
||||
val JpsModule.platform: TargetPlatform?
|
||||
get() = kotlinFacet?.settings?.platform
|
||||
get() = kotlinFacet?.settings?.targetPlatform
|
||||
|
||||
val JpsModule.kotlinKind: KotlinModuleKind
|
||||
get() = kotlinFacet?.settings?.kind ?: KotlinModuleKind.DEFAULT
|
||||
|
||||
Reference in New Issue
Block a user