From e4a57755702bbe7e3f8d2d1216f5ac3201b8ceb8 Mon Sep 17 00:00:00 2001 From: Andrey Zinovyev Date: Wed, 28 Apr 2021 17:08:42 +0300 Subject: [PATCH] Remove duplicated code in annotation-based-compiler-plugins-ide-support --- .../src/AllOpenGradleProjectImportHandler.kt | 4 +- .../src/AllOpenMavenProjectImportHandler.kt | 5 +- .../build.gradle.kts | 1 + ...actAnnotationPluginGradleImportHandler.kt} | 10 +-- .../src/AbstractMavenImportHandler.kt | 72 ------------------- .../src/AbstractMavenImportHandler.kt.as42 | 0 .../src/idePluginUtils.kt | 44 ------------ .../build.gradle.kts | 13 ++-- .../kotlin/plugin/ide/idePluginUtils.kt | 5 +- .../KotlinSerializationMavenImportHandler.kt | 7 +- .../lombok/lombok-ide-plugin/build.gradle.kts | 1 + .../ide/LombokMavenProjectImportHandler.kt | 6 +- .../src/NoArgGradleProjectImportHandler.kt | 6 +- .../src/NoArgMavenProjectImportHandler.kt | 5 +- ...mWithReceiverGradleProjectImportHandler.kt | 4 +- ...amWithReceiverMavenProjectImportHandler.kt | 5 +- 16 files changed, 33 insertions(+), 155 deletions(-) rename plugins/annotation-based-compiler-plugins-ide-support/src/{AbstractGradleImportHandler.kt => AbstractAnnotationPluginGradleImportHandler.kt} (87%) delete mode 100644 plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt delete mode 100644 plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as42 diff --git a/plugins/allopen/allopen-ide/src/AllOpenGradleProjectImportHandler.kt b/plugins/allopen/allopen-ide/src/AllOpenGradleProjectImportHandler.kt index 11c085f9474..0836d784efd 100644 --- a/plugins/allopen/allopen-ide/src/AllOpenGradleProjectImportHandler.kt +++ b/plugins/allopen/allopen-ide/src/AllOpenGradleProjectImportHandler.kt @@ -17,10 +17,10 @@ package org.jetbrains.kotlin.allopen.ide import org.jetbrains.kotlin.allopen.AllOpenCommandLineProcessor -import org.jetbrains.kotlin.annotation.plugin.ide.AbstractGradleImportHandler +import org.jetbrains.kotlin.annotation.plugin.ide.AbstractAnnotationPluginGradleImportHandler import org.jetbrains.kotlin.utils.PathUtil -class AllOpenGradleProjectImportHandler : AbstractGradleImportHandler() { +class AllOpenGradleProjectImportHandler : AbstractAnnotationPluginGradleImportHandler() { override val compilerPluginId = AllOpenCommandLineProcessor.PLUGIN_ID override val pluginName = "allopen" override val annotationOptionName = AllOpenCommandLineProcessor.ANNOTATION_OPTION.optionName diff --git a/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt b/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt index c902fb1bc3f..81c836c343c 100644 --- a/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt +++ b/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt @@ -17,8 +17,8 @@ package org.jetbrains.kotlin.allopen.ide import org.jetbrains.kotlin.allopen.AllOpenCommandLineProcessor -import org.jetbrains.kotlin.annotation.plugin.ide.AbstractMavenImportHandler -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup.PluginOption +import org.jetbrains.kotlin.plugin.ide.CompilerPluginSetup.PluginOption +import org.jetbrains.kotlin.plugin.ide.AbstractMavenImportHandler import org.jetbrains.kotlin.utils.PathUtil class AllOpenMavenProjectImportHandler : AbstractMavenImportHandler() { @@ -28,7 +28,6 @@ class AllOpenMavenProjectImportHandler : AbstractMavenImportHandler() { override val compilerPluginId = AllOpenCommandLineProcessor.PLUGIN_ID override val pluginName = "allopen" - override val mavenPluginArtifactName = "kotlin-maven-allopen" override val pluginJarFileFromIdea = PathUtil.kotlinPathsForIdeaPlugin.allOpenPluginJarPath override fun getOptions(enabledCompilerPlugins: List, compilerPluginOptions: List): List? { diff --git a/plugins/annotation-based-compiler-plugins-ide-support/build.gradle.kts b/plugins/annotation-based-compiler-plugins-ide-support/build.gradle.kts index dc5baae53b4..8dab8259a53 100644 --- a/plugins/annotation-based-compiler-plugins-ide-support/build.gradle.kts +++ b/plugins/annotation-based-compiler-plugins-ide-support/build.gradle.kts @@ -13,6 +13,7 @@ dependencies { compile(project(":idea:idea-jps-common")) compile(project(":idea:idea-gradle")) compile(project(":idea:idea-maven")) + api(project(":plugins:base-compiler-plugins-ide-support")) excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) } compileOnly(intellijPluginDep("gradle")) compileOnly(intellijDep()) diff --git a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractGradleImportHandler.kt b/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractAnnotationPluginGradleImportHandler.kt similarity index 87% rename from plugins/annotation-based-compiler-plugins-ide-support/src/AbstractGradleImportHandler.kt rename to plugins/annotation-based-compiler-plugins-ide-support/src/AbstractAnnotationPluginGradleImportHandler.kt index 75839a1cbd8..6e5e40f0fd8 100644 --- a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractGradleImportHandler.kt +++ b/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractAnnotationPluginGradleImportHandler.kt @@ -10,13 +10,15 @@ import com.intellij.openapi.externalSystem.model.ProjectKeys import com.intellij.openapi.externalSystem.model.project.ModuleData import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil import com.intellij.openapi.util.Key -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup.PluginOption +import org.jetbrains.kotlin.plugin.ide.CompilerPluginSetup.PluginOption import org.jetbrains.kotlin.idea.configuration.GradleProjectImportHandler import org.jetbrains.kotlin.idea.facet.KotlinFacet +import org.jetbrains.kotlin.plugin.ide.CompilerPluginSetup +import org.jetbrains.kotlin.plugin.ide.modifyCompilerArgumentsForPlugin import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData import java.io.File -abstract class AbstractGradleImportHandler : GradleProjectImportHandler { +abstract class AbstractAnnotationPluginGradleImportHandler : GradleProjectImportHandler { abstract val compilerPluginId: String abstract val pluginName: String abstract val annotationOptionName: String @@ -42,7 +44,7 @@ abstract class AbstractGradleImportHandler : Gra private fun getPluginSetupByModule( moduleNode: DataNode - ): AnnotationBasedCompilerPluginSetup? { + ): CompilerPluginSetup? { val pluginModel = moduleNode.getCopyableUserData(modelKey)?.takeIf { it.isEnabled } ?: return null val annotations = pluginModel.annotations val presets = pluginModel.presets @@ -54,7 +56,7 @@ abstract class AbstractGradleImportHandler : Gra // So we use ones from the IDEA plugin. val classpath = listOf(pluginJarFileFromIdea.absolutePath) - return AnnotationBasedCompilerPluginSetup(options, classpath) + return CompilerPluginSetup(options, classpath) } private fun getPluginSetupBySourceSet(sourceSetNode: DataNode) = diff --git a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt b/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt deleted file mode 100644 index c3fe243686c..00000000000 --- a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.annotation.plugin.ide - -import org.jdom.Element -import org.jdom.Text -import org.jetbrains.idea.maven.project.MavenProject -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup.PluginOption -import org.jetbrains.kotlin.idea.facet.KotlinFacet -import org.jetbrains.kotlin.idea.maven.MavenProjectImportHandler -import org.jetbrains.kotlin.idea.maven.KotlinMavenImporter.Companion.KOTLIN_PLUGIN_GROUP_ID -import org.jetbrains.kotlin.idea.maven.KotlinMavenImporter.Companion.KOTLIN_PLUGIN_ARTIFACT_ID -import java.io.File - -abstract class AbstractMavenImportHandler : MavenProjectImportHandler { - abstract val compilerPluginId: String - abstract val pluginName: String - abstract val mavenPluginArtifactName: String - abstract val pluginJarFileFromIdea: File - - override fun invoke(facet: KotlinFacet, mavenProject: MavenProject) { - modifyCompilerArgumentsForPlugin(facet, getPluginSetup(mavenProject), - compilerPluginId = compilerPluginId, - pluginName = pluginName) - } - - abstract fun getOptions(enabledCompilerPlugins: List, compilerPluginOptions: List): List? - - private fun getPluginSetup(mavenProject: MavenProject): AnnotationBasedCompilerPluginSetup? { - val kotlinPlugin = mavenProject.plugins.firstOrNull { - it.groupId == KOTLIN_PLUGIN_GROUP_ID && it.artifactId == KOTLIN_PLUGIN_ARTIFACT_ID - } ?: return null - - val configuration = kotlinPlugin.configurationElement ?: return null - - val enabledCompilerPlugins = configuration.getElement("compilerPlugins") - ?.getElements() - ?.flatMap { plugin -> plugin.content.mapNotNull { (it as? Text)?.text } } - ?: emptyList() - - val compilerPluginOptions = configuration.getElement("pluginOptions") - ?.getElements() - ?.flatMap { it.content } - ?.mapTo(mutableListOf()) { (it as Text).text } - ?: mutableListOf() - - // We can't use the plugin from Gradle as it may have the incompatible version - val classpath = listOf(pluginJarFileFromIdea.absolutePath) - - val options = getOptions(enabledCompilerPlugins, compilerPluginOptions) ?: return null - return AnnotationBasedCompilerPluginSetup(options, classpath) - } - - private fun Element.getElement(name: String) = content.firstOrNull { it is Element && it.name == name } as? Element - - @Suppress("UNCHECKED_CAST") - private fun Element.getElements() = content.filterIsInstance() -} \ No newline at end of file diff --git a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as42 b/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as42 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/annotation-based-compiler-plugins-ide-support/src/idePluginUtils.kt b/plugins/annotation-based-compiler-plugins-ide-support/src/idePluginUtils.kt index 83ff3e5f795..478c8e8ce81 100644 --- a/plugins/annotation-based-compiler-plugins-ide-support/src/idePluginUtils.kt +++ b/plugins/annotation-based-compiler-plugins-ide-support/src/idePluginUtils.kt @@ -17,12 +17,6 @@ package org.jetbrains.kotlin.annotation.plugin.ide import com.intellij.openapi.module.Module -import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments -import org.jetbrains.kotlin.idea.facet.KotlinFacet -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.psi.KtClass -import org.jetbrains.kotlin.psi.KtDeclaration -import java.io.File fun Module.getSpecialAnnotations(prefix: String): List { val kotlinFacet = org.jetbrains.kotlin.idea.facet.KotlinFacet.get(this) ?: return emptyList() @@ -32,42 +26,4 @@ fun Module.getSpecialAnnotations(prefix: String): List { ?.filter { it.startsWith(prefix) } ?.map { it.substring(prefix.length) } ?: emptyList() -} - -class AnnotationBasedCompilerPluginSetup(val options: List, val classpath: List) { - class PluginOption(val key: String, val value: String) -} - -internal fun modifyCompilerArgumentsForPlugin( - facet: KotlinFacet, - setup: AnnotationBasedCompilerPluginSetup?, - compilerPluginId: String, - pluginName: String -) { - val facetSettings = facet.configuration.settings - - // investigate why copyBean() sometimes throws exceptions - val commonArguments = facetSettings.compilerArguments ?: CommonCompilerArguments.DummyImpl() - - /** See [CommonCompilerArguments.PLUGIN_OPTION_FORMAT] **/ - val newOptionsForPlugin = setup?.options?.map { "plugin:$compilerPluginId:${it.key}=${it.value}" } ?: emptyList() - - val oldAllPluginOptions = - (commonArguments.pluginOptions ?: emptyArray()).filterTo(mutableListOf()) { !it.startsWith("plugin:$compilerPluginId:") } - val newAllPluginOptions = oldAllPluginOptions + newOptionsForPlugin - - val oldPluginClasspaths = (commonArguments.pluginClasspaths ?: emptyArray()).filterTo(mutableListOf()) { - val lastIndexOfFile = it.lastIndexOfAny(charArrayOf('/', File.separatorChar)) - if (lastIndexOfFile < 0) { - return@filterTo true - } - !it.drop(lastIndexOfFile + 1).matches("(kotlin-)?(maven-)?$pluginName-.*\\.jar".toRegex()) - } - - val newPluginClasspaths = oldPluginClasspaths + (setup?.classpath ?: emptyList()) - - commonArguments.pluginOptions = newAllPluginOptions.toTypedArray() - commonArguments.pluginClasspaths = newPluginClasspaths.toTypedArray() - - facetSettings.compilerArguments = commonArguments } \ No newline at end of file diff --git a/plugins/base-compiler-plugins-ide-support/build.gradle.kts b/plugins/base-compiler-plugins-ide-support/build.gradle.kts index dc5baae53b4..85e879cfb91 100644 --- a/plugins/base-compiler-plugins-ide-support/build.gradle.kts +++ b/plugins/base-compiler-plugins-ide-support/build.gradle.kts @@ -5,14 +5,11 @@ plugins { } dependencies { - compile(project(":compiler:util")) - compile(project(":compiler:frontend")) - compile(project(":compiler:cli-common")) - compile(project(":idea")) - compile(project(":idea:idea-jvm")) - compile(project(":idea:idea-jps-common")) - compile(project(":idea:idea-gradle")) - compile(project(":idea:idea-maven")) + implementation(project(":idea")) + implementation(project(":idea:idea-jvm")) + implementation(project(":idea:idea-jps-common")) + implementation(project(":idea:idea-gradle")) + implementation(project(":idea:idea-maven")) excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) } compileOnly(intellijPluginDep("gradle")) compileOnly(intellijDep()) diff --git a/plugins/base-compiler-plugins-ide-support/src/org/jetbrains/kotlin/plugin/ide/idePluginUtils.kt b/plugins/base-compiler-plugins-ide-support/src/org/jetbrains/kotlin/plugin/ide/idePluginUtils.kt index 08041706942..3d49e0e9a23 100644 --- a/plugins/base-compiler-plugins-ide-support/src/org/jetbrains/kotlin/plugin/ide/idePluginUtils.kt +++ b/plugins/base-compiler-plugins-ide-support/src/org/jetbrains/kotlin/plugin/ide/idePluginUtils.kt @@ -9,14 +9,11 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.idea.facet.KotlinFacet import java.io.File -//todo this is basically a copy-paste of the same file from annotation-based-compiler-plugins-ide-support -//and should be merged together later - class CompilerPluginSetup(val options: List, val classpath: List) { class PluginOption(val key: String, val value: String) } -internal fun modifyCompilerArgumentsForPlugin( +fun modifyCompilerArgumentsForPlugin( facet: KotlinFacet, setup: CompilerPluginSetup?, compilerPluginId: String, diff --git a/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt b/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt index 6977cfc4ede..9cdf47db403 100644 --- a/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt +++ b/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt @@ -5,20 +5,19 @@ package org.jetbrains.kotlinx.serialization.idea -import org.jetbrains.kotlin.annotation.plugin.ide.AbstractMavenImportHandler -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup +import org.jetbrains.kotlin.plugin.ide.AbstractMavenImportHandler +import org.jetbrains.kotlin.plugin.ide.CompilerPluginSetup import java.io.File class KotlinSerializationMavenImportHandler : AbstractMavenImportHandler() { override val compilerPluginId: String = "org.jetbrains.kotlinx.serialization" override val pluginName: String = "serialization" - override val mavenPluginArtifactName: String = "kotlin-maven-serialization" override val pluginJarFileFromIdea: File get() = File(KotlinSerializationImportHandler.PLUGIN_JPS_JAR) override fun getOptions( enabledCompilerPlugins: List, compilerPluginOptions: List - ): List? = + ): List? = if ("kotlinx-serialization" in enabledCompilerPlugins) emptyList() else null } \ No newline at end of file diff --git a/plugins/lombok/lombok-ide-plugin/build.gradle.kts b/plugins/lombok/lombok-ide-plugin/build.gradle.kts index a75cf3b5422..c6bf270ee71 100644 --- a/plugins/lombok/lombok-ide-plugin/build.gradle.kts +++ b/plugins/lombok/lombok-ide-plugin/build.gradle.kts @@ -13,6 +13,7 @@ dependencies { compileOnly(project(":idea:idea-jvm")) compileOnly(project(":idea:idea-jps-common")) compileOnly(project(":idea:idea-maven")) + compileOnly(project(":idea:idea-gradle")) compileOnly(intellijDep()) excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) } compileOnly(intellijPluginDep("gradle")) diff --git a/plugins/lombok/lombok-ide-plugin/src/org/jetbrains/kotlin/lombok/ide/LombokMavenProjectImportHandler.kt b/plugins/lombok/lombok-ide-plugin/src/org/jetbrains/kotlin/lombok/ide/LombokMavenProjectImportHandler.kt index 922d3e89825..920033c9d0c 100644 --- a/plugins/lombok/lombok-ide-plugin/src/org/jetbrains/kotlin/lombok/ide/LombokMavenProjectImportHandler.kt +++ b/plugins/lombok/lombok-ide-plugin/src/org/jetbrains/kotlin/lombok/ide/LombokMavenProjectImportHandler.kt @@ -23,9 +23,9 @@ class LombokMavenProjectImportHandler : AbstractMavenImportHandler() { ): List? { if (!enabledCompilerPlugins.contains(pluginName)) return null - return compilerPluginOptions.mapNotNull { v -> - if (v.startsWith(CONFIG_FILE_PREFIX)) { - val location = v.substring(CONFIG_FILE_PREFIX.length) + return compilerPluginOptions.mapNotNull { option -> + if (option.startsWith(CONFIG_FILE_PREFIX)) { + val location = option.substring(CONFIG_FILE_PREFIX.length) PluginOption(CONFIG_FILE_OPTION.optionName, location) } else { null diff --git a/plugins/noarg/noarg-ide/src/NoArgGradleProjectImportHandler.kt b/plugins/noarg/noarg-ide/src/NoArgGradleProjectImportHandler.kt index 257b6170cdc..762b3b5a41f 100644 --- a/plugins/noarg/noarg-ide/src/NoArgGradleProjectImportHandler.kt +++ b/plugins/noarg/noarg-ide/src/NoArgGradleProjectImportHandler.kt @@ -16,12 +16,12 @@ package org.jetbrains.kotlin.noarg.ide -import org.jetbrains.kotlin.annotation.plugin.ide.AbstractGradleImportHandler -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup.PluginOption +import org.jetbrains.kotlin.annotation.plugin.ide.AbstractAnnotationPluginGradleImportHandler +import org.jetbrains.kotlin.plugin.ide.CompilerPluginSetup.PluginOption import org.jetbrains.kotlin.noarg.NoArgCommandLineProcessor import org.jetbrains.kotlin.utils.PathUtil -class NoArgGradleProjectImportHandler : AbstractGradleImportHandler() { +class NoArgGradleProjectImportHandler : AbstractAnnotationPluginGradleImportHandler() { override val compilerPluginId = NoArgCommandLineProcessor.PLUGIN_ID override val pluginName = "noarg" override val annotationOptionName = NoArgCommandLineProcessor.ANNOTATION_OPTION.optionName diff --git a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt b/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt index 23868eda005..bb4edf83f56 100644 --- a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt +++ b/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt @@ -16,9 +16,9 @@ package org.jetbrains.kotlin.noarg.ide -import org.jetbrains.kotlin.annotation.plugin.ide.AbstractMavenImportHandler -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup.PluginOption +import org.jetbrains.kotlin.plugin.ide.CompilerPluginSetup.PluginOption import org.jetbrains.kotlin.noarg.NoArgCommandLineProcessor +import org.jetbrains.kotlin.plugin.ide.AbstractMavenImportHandler import org.jetbrains.kotlin.utils.PathUtil class NoArgMavenProjectImportHandler : AbstractMavenImportHandler() { @@ -29,7 +29,6 @@ class NoArgMavenProjectImportHandler : AbstractMavenImportHandler() { override val compilerPluginId = NoArgCommandLineProcessor.PLUGIN_ID override val pluginName = "noarg" - override val mavenPluginArtifactName = "kotlin-maven-noarg" override val pluginJarFileFromIdea = PathUtil.kotlinPathsForIdeaPlugin.noArgPluginJarPath override fun getOptions(enabledCompilerPlugins: List, compilerPluginOptions: List): List? { diff --git a/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverGradleProjectImportHandler.kt b/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverGradleProjectImportHandler.kt index 4d3ec03e896..6e810307e82 100644 --- a/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverGradleProjectImportHandler.kt +++ b/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverGradleProjectImportHandler.kt @@ -16,11 +16,11 @@ package org.jetbrains.kotlin.samWithReceiver.ide -import org.jetbrains.kotlin.annotation.plugin.ide.AbstractGradleImportHandler +import org.jetbrains.kotlin.annotation.plugin.ide.AbstractAnnotationPluginGradleImportHandler import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverCommandLineProcessor import org.jetbrains.kotlin.utils.PathUtil -class SamWithReceiverGradleProjectImportHandler : AbstractGradleImportHandler() { +class SamWithReceiverGradleProjectImportHandler : AbstractAnnotationPluginGradleImportHandler() { override val compilerPluginId = SamWithReceiverCommandLineProcessor.PLUGIN_ID override val pluginName = "sam-with-receiver" override val annotationOptionName = SamWithReceiverCommandLineProcessor.ANNOTATION_OPTION.optionName diff --git a/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt b/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt index b44daaa3c9d..bb1f02caca1 100644 --- a/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt +++ b/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt @@ -16,8 +16,8 @@ package org.jetbrains.kotlin.samWithReceiver.ide -import org.jetbrains.kotlin.annotation.plugin.ide.AbstractMavenImportHandler -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup.PluginOption +import org.jetbrains.kotlin.plugin.ide.CompilerPluginSetup.PluginOption +import org.jetbrains.kotlin.plugin.ide.AbstractMavenImportHandler import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverCommandLineProcessor import org.jetbrains.kotlin.utils.PathUtil @@ -28,7 +28,6 @@ class SamWithReceiverMavenProjectImportHandler : AbstractMavenImportHandler() { override val compilerPluginId = SamWithReceiverCommandLineProcessor.PLUGIN_ID override val pluginName = "samWithReceiver" - override val mavenPluginArtifactName = "kotlin-maven-sam-with-receiver" override val pluginJarFileFromIdea = PathUtil.kotlinPathsForIdeaPlugin.samWithReceiverJarPath override fun getOptions(enabledCompilerPlugins: List, compilerPluginOptions: List): List? {