summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Novozhilov <dmitriy.novozhilov@jetbrains.com>2022-06-23 13:35:46 +0200
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>2022-06-27 11:15:47 +0000
commitf043d5a39a7604d498020558ceb2fc0960056659 (patch)
treede18edcf7f8507a781e3370e3447aa1e1f812f90
parent68301b329379a239870cfad5561f9fe66f71809c (diff)
downloadintellij-kotlin-f043d5a39a7604d498020558ceb2fc0960056659.tar.gz
[Kotlin] Fix compilation of SamWithReceiver compiler plugin support
(cherry picked from commit 067cd7054dfaccc0bf6ecce2a31aabeeca1fcb59) GitOrigin-RevId: 6de988d3447e09c3b9221d06e6a19b52cb087324
-rw-r--r--plugins/kotlin/compiler-plugins/sam-with-receiver/common/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/IdeSamWithReceiverComponentContributor.kt8
-rw-r--r--plugins/kotlin/compiler-plugins/sam-with-receiver/gradle/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/gradleJava/SamWithReceiverGradleProjectImportHandler.kt8
-rw-r--r--plugins/kotlin/compiler-plugins/sam-with-receiver/maven/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/maven/SamWithReceiverMavenProjectImportHandler.kt10
-rw-r--r--plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleHighlightingTest.kt7
4 files changed, 16 insertions, 17 deletions
diff --git a/plugins/kotlin/compiler-plugins/sam-with-receiver/common/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/IdeSamWithReceiverComponentContributor.kt b/plugins/kotlin/compiler-plugins/sam-with-receiver/common/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/IdeSamWithReceiverComponentContributor.kt
index 89b3bc9fe917..ccb096379bea 100644
--- a/plugins/kotlin/compiler-plugins/sam-with-receiver/common/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/IdeSamWithReceiverComponentContributor.kt
+++ b/plugins/kotlin/compiler-plugins/sam-with-receiver/common/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/IdeSamWithReceiverComponentContributor.kt
@@ -19,13 +19,13 @@ import org.jetbrains.kotlin.idea.caches.project.ScriptModuleInfo
import org.jetbrains.kotlin.idea.compilerPlugin.getSpecialAnnotations
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.isJvm
-import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverCommandLineProcessor.Companion.ANNOTATION_OPTION
-import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverCommandLineProcessor.Companion.PLUGIN_ID
+import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverPluginNames.ANNOTATION_OPTION_NAME
+import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverPluginNames.PLUGIN_ID
import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverResolverExtension
class IdeSamWithReceiverComponentContributor(val project: Project) : StorageComponentContainerContributor {
private companion object {
- val ANNOTATION_OPTION_PREFIX = "plugin:$PLUGIN_ID:${ANNOTATION_OPTION.optionName}="
+ val ANNOTATION_OPTION_PREFIX = "plugin:$PLUGIN_ID:${ANNOTATION_OPTION_NAME}="
}
private val cache = CachedValuesManager.getManager(project).createCachedValue({
@@ -60,4 +60,4 @@ class IdeSamWithReceiverComponentContributor(val project: Project) : StorageComp
container.useInstance(SamWithReceiverResolverExtension(annotations))
}
-} \ No newline at end of file
+}
diff --git a/plugins/kotlin/compiler-plugins/sam-with-receiver/gradle/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/gradleJava/SamWithReceiverGradleProjectImportHandler.kt b/plugins/kotlin/compiler-plugins/sam-with-receiver/gradle/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/gradleJava/SamWithReceiverGradleProjectImportHandler.kt
index beb293bd092e..692c10eabe02 100644
--- a/plugins/kotlin/compiler-plugins/sam-with-receiver/gradle/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/gradleJava/SamWithReceiverGradleProjectImportHandler.kt
+++ b/plugins/kotlin/compiler-plugins/sam-with-receiver/gradle/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/gradleJava/SamWithReceiverGradleProjectImportHandler.kt
@@ -4,18 +4,18 @@ package org.jetbrains.kotlin.idea.compilerPlugin.samWithReceiver.gradleJava
import org.jetbrains.kotlin.idea.artifacts.KotlinArtifacts
import org.jetbrains.kotlin.idea.gradleJava.compilerPlugin.AbstractAnnotationBasedCompilerPluginGradleImportHandler
-import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverCommandLineProcessor
+import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverPluginNames
import org.jetbrains.kotlin.idea.gradleTooling.model.samWithReceiver.SamWithReceiverModel
class SamWithReceiverGradleProjectImportHandler : AbstractAnnotationBasedCompilerPluginGradleImportHandler<SamWithReceiverModel>() {
- override val compilerPluginId = SamWithReceiverCommandLineProcessor.PLUGIN_ID
+ override val compilerPluginId = SamWithReceiverPluginNames.PLUGIN_ID
override val pluginName = "sam-with-receiver"
- override val annotationOptionName = SamWithReceiverCommandLineProcessor.ANNOTATION_OPTION.optionName
+ override val annotationOptionName = SamWithReceiverPluginNames.ANNOTATION_OPTION_NAME
override val pluginJarFileFromIdea = KotlinArtifacts.instance.samWithReceiverCompilerPlugin
override val modelKey = SamWithReceiverProjectResolverExtension.KEY
override fun getAnnotationsForPreset(presetName: String): List<String> {
- for ((name, annotations) in SamWithReceiverCommandLineProcessor.SUPPORTED_PRESETS.entries) {
+ for ((name, annotations) in SamWithReceiverPluginNames.SUPPORTED_PRESETS.entries) {
if (presetName == name) {
return annotations
}
diff --git a/plugins/kotlin/compiler-plugins/sam-with-receiver/maven/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/maven/SamWithReceiverMavenProjectImportHandler.kt b/plugins/kotlin/compiler-plugins/sam-with-receiver/maven/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/maven/SamWithReceiverMavenProjectImportHandler.kt
index e504532bb5fa..1de45bc37c03 100644
--- a/plugins/kotlin/compiler-plugins/sam-with-receiver/maven/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/maven/SamWithReceiverMavenProjectImportHandler.kt
+++ b/plugins/kotlin/compiler-plugins/sam-with-receiver/maven/src/org/jetbrains/kotlin/idea/compilerPlugin/samWithReceiver/maven/SamWithReceiverMavenProjectImportHandler.kt
@@ -6,14 +6,14 @@ import org.jetbrains.idea.maven.project.MavenProject
import org.jetbrains.kotlin.idea.maven.compilerPlugin.AbstractMavenImportHandler
import org.jetbrains.kotlin.idea.compilerPlugin.CompilerPluginSetup.PluginOption
import org.jetbrains.kotlin.idea.artifacts.KotlinArtifacts
-import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverCommandLineProcessor
+import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverPluginNames
class SamWithReceiverMavenProjectImportHandler : AbstractMavenImportHandler() {
private companion object {
- val ANNOTATION_PARAMETER_PREFIX = "sam-with-receiver:${SamWithReceiverCommandLineProcessor.ANNOTATION_OPTION.optionName}="
+ val ANNOTATION_PARAMETER_PREFIX = "sam-with-receiver:${SamWithReceiverPluginNames.ANNOTATION_OPTION_NAME}="
}
- override val compilerPluginId = SamWithReceiverCommandLineProcessor.PLUGIN_ID
+ override val compilerPluginId = SamWithReceiverPluginNames.PLUGIN_ID
override val pluginName = "samWithReceiver"
override val mavenPluginArtifactName = "kotlin-maven-sam-with-receiver"
override val pluginJarFileFromIdea = KotlinArtifacts.instance.samWithReceiverCompilerPlugin
@@ -29,7 +29,7 @@ class SamWithReceiverMavenProjectImportHandler : AbstractMavenImportHandler() {
val annotations = mutableListOf<String>()
- for ((presetName, presetAnnotations) in SamWithReceiverCommandLineProcessor.SUPPORTED_PRESETS) {
+ for ((presetName, presetAnnotations) in SamWithReceiverPluginNames.SUPPORTED_PRESETS) {
if (presetName in enabledCompilerPlugins) {
annotations.addAll(presetAnnotations)
}
@@ -40,6 +40,6 @@ class SamWithReceiverMavenProjectImportHandler : AbstractMavenImportHandler() {
text.substring(ANNOTATION_PARAMETER_PREFIX.length)
})
- return annotations.map { PluginOption(SamWithReceiverCommandLineProcessor.ANNOTATION_OPTION.optionName, it) }
+ return annotations.map { PluginOption(SamWithReceiverPluginNames.ANNOTATION_OPTION_NAME, it) }
}
}
diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleHighlightingTest.kt b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleHighlightingTest.kt
index d20113c85b84..365636e03076 100644
--- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleHighlightingTest.kt
+++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/caches/resolve/MultiModuleHighlightingTest.kt
@@ -38,8 +38,7 @@ import org.jetbrains.kotlin.idea.util.projectStructure.sdk
import org.jetbrains.kotlin.idea.util.sourceRoots
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtPsiFactory
-import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverCommandLineProcessor.Companion.ANNOTATION_OPTION
-import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverCommandLineProcessor.Companion.PLUGIN_ID
+import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverPluginNames
import org.jetbrains.kotlin.idea.test.KotlinCompilerStandalone
import org.junit.Assert.assertNotEquals
import org.junit.internal.runners.JUnit38ClassRunner
@@ -219,12 +218,12 @@ open class MultiModuleHighlightingTest : AbstractMultiModuleHighlightingTest() {
fun testSamWithReceiverExtension() {
val module1 = module("m1").setupKotlinFacet {
settings.compilerArguments!!.pluginOptions =
- arrayOf("plugin:$PLUGIN_ID:${ANNOTATION_OPTION.optionName}=anno.A")
+ arrayOf("plugin:${SamWithReceiverPluginNames.PLUGIN_ID}:${SamWithReceiverPluginNames.ANNOTATION_OPTION_NAME}=anno.A")
}
val module2 = module("m2").setupKotlinFacet {
settings.compilerArguments!!.pluginOptions =
- arrayOf("plugin:$PLUGIN_ID:${ANNOTATION_OPTION.optionName}=anno.B")
+ arrayOf("plugin:${SamWithReceiverPluginNames.PLUGIN_ID}:${SamWithReceiverPluginNames.ANNOTATION_OPTION_NAME}=anno.B")
}