From aeb7f8400ae688b82f7b5774d54b1d0660ab5a14 Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Tue, 28 May 2019 15:43:23 +0300 Subject: [PATCH] Rename platform to targetPlatform in KotlinFacetSettings to avoid ambiguity in Java --- .../idea/caches/project/multiplatformUtil.kt | 4 +- .../idea/facet/KotlinVersionInfoProvider.kt | 2 +- .../jetbrains/kotlin/idea/project/Platform.kt | 7 +-- .../KotlinMPPGradleProjectTaskRunner.java | 4 +- .../run/KotlinMPPGradleTestTasksProvider.kt | 3 +- .../gradle/GradleFacetImportTest.kt | 46 +++++++-------- .../kotlin/config/KotlinFacetSettings.kt | 4 +- .../kotlin/config/facetSerialization.kt | 3 +- .../kotlin/idea/maven/KotlinMavenImporter.kt | 4 +- .../idea/maven/KotlinMavenImporterTest.kt | 57 +++++++++---------- .../idea/facet/KotlinFacetEditorGeneralTab.kt | 9 +-- .../jetbrains/kotlin/idea/facet/facetUtils.kt | 3 +- .../configuration/ConfigureKotlinTest.java | 14 ++--- .../jps/build/AbstractIncrementalJpsTest.kt | 2 +- .../jps/build/dependeciestxt/ModulesTxt.kt | 6 +- .../kotlin/jps/model/ModuleSettings.kt | 2 +- 16 files changed, 78 insertions(+), 92 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/multiplatformUtil.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/multiplatformUtil.kt index fa70e290755..13070a962aa 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/multiplatformUtil.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/multiplatformUtil.kt @@ -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 } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/facet/KotlinVersionInfoProvider.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/facet/KotlinVersionInfoProvider.kt index ed3f0ac0dca..f81d1748645 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/facet/KotlinVersionInfoProvider.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/facet/KotlinVersionInfoProvider.kt @@ -92,7 +92,7 @@ private fun Iterable.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() } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/Platform.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/Platform.kt index 2aed8533746..a8c063afa51 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/Platform.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/Platform.kt @@ -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? diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunner.java b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunner.java index a38bf5d0c14..5f43f9732b9 100644 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunner.java +++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunner.java @@ -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); diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/KotlinMPPGradleTestTasksProvider.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/KotlinMPPGradleTestTasksProvider.kt index 78d8f043c59..9e34b8ec296 100644 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/KotlinMPPGradleTestTasksProvider.kt +++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/KotlinMPPGradleTestTasksProvider.kt @@ -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 { diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt index 20f8bb1c349..3acfe45e21c 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt @@ -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) } diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt index 6ca28bd8443..27306845427 100644 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt +++ b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt @@ -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? diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt index 31ac6783852..b3c3b92dfc2 100644 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt +++ b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/facetSerialization.kt @@ -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) { diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt index b62c0f155e5..fdf3bfbb597 100644 --- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt +++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt @@ -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) diff --git a/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt b/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt index 1d560d8b127..6870aa70692 100644 --- a/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt +++ b/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt @@ -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().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().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) } } diff --git a/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetEditorGeneralTab.kt b/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetEditorGeneralTab.kt index ac2e885613c..eead92f5a0e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetEditorGeneralTab.kt +++ b/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetEditorGeneralTab.kt @@ -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 diff --git a/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt b/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt index 14646974f6c..0e0c1fda985 100644 --- a/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt @@ -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 ) ) diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java b/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java index 4c060775a74..c7d645df9ff 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java @@ -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()); } diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt index 09e9fc3020a..d0b7eada4ac 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt @@ -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 -> { diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/ModulesTxt.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/ModulesTxt.kt index 0d6ee77ac47..1a0dc91ae0e 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/ModulesTxt.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/dependeciestxt/ModulesTxt.kt @@ -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 { diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/model/ModuleSettings.kt b/jps-plugin/src/org/jetbrains/kotlin/jps/model/ModuleSettings.kt index 52458e2db0b..1e8deea43fe 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/model/ModuleSettings.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/jps/model/ModuleSettings.kt @@ -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