summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Bobko <nikita.bobko@jetbrains.com>2022-04-28 13:03:17 +0200
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>2022-05-13 11:53:09 +0000
commitc13f980faadff0d81fc8d2f5384db250fb472550 (patch)
treea27cd8b4b30910a795156e01977a048d3dae55ec
parent510e2c4f80fca005a159d32e0ae5f35992cb7835 (diff)
downloadintellij-kotlin-c13f980faadff0d81fc8d2f5384db250fb472550.tar.gz
Move KotlinFacetSettingsProvider from kotlin repo to intellij repo
This class isn't used in kotlin repository (kotlin/jps to be precise) and the class was causing troubles in kotlin/jps (I was dropping dependency on intellij-core in kotlin/jps and KotlinFacetSettingsProvider depends on com.intellij.openapi.module.Module and com.intellij.openapi.project.Project which are intellij-core classes) The class was moved from `jps/jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt` file (so you can find a commit in which it was moved) Also, it looks like KotlinFacetSettingsProvider interface isn't needed because there is only one implementation, and it doesn't hold any state so it could be converted from a service to simple a class. But, unfortunatelly, at least two external plugins reference this class, so I decided not to break compatibility for nothing. The list of plugins that reference KotlinFacetSettings: * org.spekframework * melabsinthiatum.kotlin-mpp-shared-items-browser (cherry picked from commit ab9fe1205e5f95c30485e54cb1b1b059b4f89a01) GitOrigin-RevId: 5514b25fe86c34416e4707a12eee263472ae6f3d
-rw-r--r--plugins/kotlin/analysis/src/org/jetbrains/kotlin/config/KotlinFacetSettingsProvider.kt15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/kotlin/analysis/src/org/jetbrains/kotlin/config/KotlinFacetSettingsProvider.kt b/plugins/kotlin/analysis/src/org/jetbrains/kotlin/config/KotlinFacetSettingsProvider.kt
new file mode 100644
index 000000000000..742a9704ecf3
--- /dev/null
+++ b/plugins/kotlin/analysis/src/org/jetbrains/kotlin/config/KotlinFacetSettingsProvider.kt
@@ -0,0 +1,15 @@
+// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package org.jetbrains.kotlin.config
+
+import com.intellij.openapi.module.Module
+import com.intellij.openapi.project.Project
+
+interface KotlinFacetSettingsProvider {
+ fun getSettings(module: Module): KotlinFacetSettings?
+ fun getInitializedSettings(module: Module): KotlinFacetSettings
+
+ companion object {
+ fun getInstance(project: Project): KotlinFacetSettingsProvider? = project.takeUnless(Project::isDisposed)
+ ?.getService(KotlinFacetSettingsProvider::class.java)
+ }
+}