Remove Maven parts from all-open and no-arg
diff --git a/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt b/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt
deleted file mode 100644
index 5e78491..0000000
--- a/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt
+++ /dev/null
@@ -1,56 +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.allopen.ide
-
-import org.jetbrains.kotlin.allopen.AllOpenCommandLineProcessor
-import org.jetbrains.kotlin.annotation.plugin.ide.AbstractMavenImportHandler
-
-class AllOpenMavenProjectImportHandler : AbstractMavenImportHandler() {
- private companion object {
- val ANNOTATION_PARAMETER_PREFIX = "all-open:${AllOpenCommandLineProcessor.ANNOTATION_OPTION.name}="
-
- private val SPRING_ALLOPEN_ANNOTATIONS = listOf(
- "org.springframework.stereotype.Component",
- "org.springframework.transaction.annotation.Transactional",
- "org.springframework.scheduling.annotation.Async",
- "org.springframework.cache.annotation.Cacheable"
- )
- }
-
- override val compilerPluginId = AllOpenCommandLineProcessor.PLUGIN_ID
- override val pluginName = "allopen"
- override val annotationOptionName = AllOpenCommandLineProcessor.ANNOTATION_OPTION.name
- override val mavenPluginArtifactName = "kotlin-maven-allopen"
-
- override fun getAnnotations(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<String>? {
- if ("all-open" !in enabledCompilerPlugins && "spring" !in enabledCompilerPlugins) {
- return null
- }
-
- val annotations = mutableListOf<String>()
- if ("spring" in enabledCompilerPlugins) {
- annotations.addAll(SPRING_ALLOPEN_ANNOTATIONS)
- }
-
- annotations.addAll(compilerPluginOptions.mapNotNull { text ->
- if (!text.startsWith(ANNOTATION_PARAMETER_PREFIX)) return@mapNotNull null
- text.substring(ANNOTATION_PARAMETER_PREFIX.length)
- })
-
- return annotations
- }
-}
\ No newline at end of file
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 93be6d3..0000000
--- a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt
+++ /dev/null
@@ -1,78 +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.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 annotationOptionName: String
- abstract val mavenPluginArtifactName: String
-
- override fun invoke(facet: KotlinFacet, mavenProject: MavenProject) {
- modifyCompilerArgumentsForPlugin(facet, getPluginSetup(mavenProject),
- compilerPluginId = compilerPluginId,
- pluginName = pluginName,
- annotationOptionName = annotationOptionName)
- }
-
- abstract fun getAnnotations(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<String>?
-
- 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 runtimeJarFile = mavenProject.dependencies
- .firstOrNull { it.groupId == KOTLIN_PLUGIN_GROUP_ID &&
- (it.artifactId == "kotlin-runtime" || it.artifactId == "kotlin-stdlib") }
- ?.file ?: return null
- val runtimeVersion = runtimeJarFile.parentFile.name
-
- val mavenCompilerPluginJar = File(runtimeJarFile.parentFile.parentFile.parentFile,
- "$mavenPluginArtifactName/$runtimeVersion/$mavenPluginArtifactName-$runtimeVersion.jar")
-
- 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<String>()
-
- val annotationFqNames = getAnnotations(enabledCompilerPlugins, compilerPluginOptions) ?: return null
- return AnnotationBasedCompilerPluginSetup(annotationFqNames, listOf(mavenCompilerPluginJar.absolutePath))
- }
-
- 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<Element>()
-}
\ No newline at end of file
diff --git a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt b/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt
deleted file mode 100644
index 1a8ef64..0000000
--- a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt
+++ /dev/null
@@ -1,50 +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.noarg.ide
-
-import org.jetbrains.kotlin.noarg.NoArgCommandLineProcessor
-import org.jetbrains.kotlin.annotation.plugin.ide.AbstractMavenImportHandler
-
-class NoArgMavenProjectImportHandler : AbstractMavenImportHandler() {
- private companion object {
- val ANNOTATATION_PARAMETER_PREFIX = "no-arg:${NoArgCommandLineProcessor.ANNOTATION_OPTION.name}="
- private val JPA_NOARG_ANNOTATIONS = listOf("javax.persistence.Entity")
- }
-
- override val compilerPluginId = NoArgCommandLineProcessor.PLUGIN_ID
- override val pluginName = "noarg"
- override val annotationOptionName = NoArgCommandLineProcessor.ANNOTATION_OPTION.name
- override val mavenPluginArtifactName = "kotlin-maven-noarg"
-
- override fun getAnnotations(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<String>? {
- if ("no-arg" !in enabledCompilerPlugins && "jpa" !in enabledCompilerPlugins) {
- return null
- }
-
- val annotations = mutableListOf<String>()
- if ("jpa" in enabledCompilerPlugins) {
- annotations.addAll(JPA_NOARG_ANNOTATIONS)
- }
-
- annotations.addAll(compilerPluginOptions.mapNotNull { text ->
- if (!text.startsWith(ANNOTATATION_PARAMETER_PREFIX)) return@mapNotNull null
- text.substring(ANNOTATATION_PARAMETER_PREFIX.length)
- })
-
- return annotations
- }
-}
\ No newline at end of file