[CHERRY PICKED FROM IJ] [jps] cleanup deprecated usages of KotlinFacetSettings.isHmppEnabled

GitOrigin-RevId: 6b20c99f5e96989c47ca3b921bd68916c8e14a89
Original commit: https://github.com/JetBrains/intellij-community/commit/6edf1a0fb3acc036f015c9263c5289f83385e9aa
This commit is contained in:
Dmitry Gridin
2021-03-30 13:39:04 +07:00
committed by Nikita Bobko
parent f3d5a71c34
commit 8f6722a1fd
2 changed files with 8 additions and 11 deletions
@@ -1,11 +1,10 @@
/* /*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. * 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.config package org.jetbrains.kotlin.config
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.module.Module import com.intellij.openapi.module.Module
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.cli.common.arguments.Argument import org.jetbrains.kotlin.cli.common.arguments.Argument
@@ -264,10 +263,12 @@ class KotlinFacetSettings {
var externalProjectId: String = "" var externalProjectId: String = ""
@Deprecated(message = "Use mppVersion.isHmppEnabled")
var isHmppEnabled: Boolean = false var isHmppEnabled: Boolean = false
@Deprecated(message = "Use mppVersion.isHmppEnabled", ReplaceWith("mppVersion.isHmpp"))
get
val mppVersion: KotlinMultiplatformVersion? val mppVersion: KotlinMultiplatformVersion?
@Suppress("DEPRECATION")
get() = when { get() = when {
isHmppEnabled -> KotlinMultiplatformVersion.M3 isHmppEnabled -> KotlinMultiplatformVersion.M3
kind.isNewMPP -> KotlinMultiplatformVersion.M2 kind.isNewMPP -> KotlinMultiplatformVersion.M2
@@ -283,11 +284,7 @@ interface KotlinFacetSettingsProvider {
fun getInitializedSettings(module: Module): KotlinFacetSettings fun getInitializedSettings(module: Module): KotlinFacetSettings
companion object { companion object {
fun getInstance(project: Project): KotlinFacetSettingsProvider? { fun getInstance(project: Project): KotlinFacetSettingsProvider? = project.takeUnless(Project::isDisposed)
if (project.isDisposed) { ?.getService(KotlinFacetSettingsProvider::class.java)
return null
}
return ServiceManager.getService(project, KotlinFacetSettingsProvider::class.java)
}
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -322,7 +322,7 @@ private fun KotlinFacetSettings.writeLatestConfig(element: Element) {
if (externalProjectId.isNotEmpty()) { if (externalProjectId.isNotEmpty()) {
element.setAttribute("externalProjectId", externalProjectId) element.setAttribute("externalProjectId", externalProjectId)
} }
if (isHmppEnabled) { if (mppVersion.isHmpp) {
element.setAttribute("isHmppProject", mppVersion.isHmpp.toString()) element.setAttribute("isHmppProject", mppVersion.isHmpp.toString())
} }
if (externalSystemRunTasks.isNotEmpty()) { if (externalSystemRunTasks.isNotEmpty()) {