Compiler plugins: Refactor Maven import handlers in order to support other plugin options

This commit is contained in:
Yan Zhulanow
2017-12-15 18:32:02 +09:00
parent a85b4ddb0f
commit 3512675d96
6 changed files with 28 additions and 27 deletions
@@ -17,6 +17,7 @@
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.noarg.NoArgCommandLineProcessor
import org.jetbrains.kotlin.utils.PathUtil
@@ -27,11 +28,10 @@ class NoArgMavenProjectImportHandler : AbstractMavenImportHandler() {
override val compilerPluginId = NoArgCommandLineProcessor.PLUGIN_ID
override val pluginName = "noarg"
override val annotationOptionName = NoArgCommandLineProcessor.ANNOTATION_OPTION.name
override val mavenPluginArtifactName = "kotlin-maven-noarg"
override val pluginJarFileFromIdea = PathUtil.kotlinPathsForIdeaPlugin.noArgPluginJarPath
override fun getAnnotations(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<String>? {
override fun getOptions(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<PluginOption>? {
if ("no-arg" !in enabledCompilerPlugins && "jpa" !in enabledCompilerPlugins) {
return null
}
@@ -48,6 +48,6 @@ class NoArgMavenProjectImportHandler : AbstractMavenImportHandler() {
text.substring(ANNOTATATION_PARAMETER_PREFIX.length)
})
return annotations
return annotations.mapTo(mutableListOf()) { PluginOption(NoArgCommandLineProcessor.ANNOTATION_OPTION.name, it) }
}
}