Compiler plugins: Refactor Maven import handlers in order to support other plugin options
This commit is contained in:
+4
-3
@@ -17,6 +17,8 @@
|
||||
package org.jetbrains.kotlin.samWithReceiver.ide
|
||||
|
||||
import org.jetbrains.kotlin.annotation.plugin.ide.AbstractMavenImportHandler
|
||||
import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup
|
||||
import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup.PluginOption
|
||||
import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverCommandLineProcessor
|
||||
import org.jetbrains.kotlin.utils.PathUtil
|
||||
|
||||
@@ -27,11 +29,10 @@ class SamWithReceiverMavenProjectImportHandler : AbstractMavenImportHandler() {
|
||||
|
||||
override val compilerPluginId = SamWithReceiverCommandLineProcessor.PLUGIN_ID
|
||||
override val pluginName = "samWithReceiver"
|
||||
override val annotationOptionName = SamWithReceiverCommandLineProcessor.ANNOTATION_OPTION.name
|
||||
override val mavenPluginArtifactName = "kotlin-maven-sam-with-receiver"
|
||||
override val pluginJarFileFromIdea = PathUtil.kotlinPathsForIdeaPlugin.allOpenPluginJarPath
|
||||
|
||||
override fun getAnnotations(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<String>? {
|
||||
override fun getOptions(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<PluginOption>? {
|
||||
if ("sam-with-receiver" !in enabledCompilerPlugins) {
|
||||
return null
|
||||
}
|
||||
@@ -49,6 +50,6 @@ class SamWithReceiverMavenProjectImportHandler : AbstractMavenImportHandler() {
|
||||
text.substring(ANNOTATION_PARAMETER_PREFIX.length)
|
||||
})
|
||||
|
||||
return annotations
|
||||
return annotations.map { PluginOption(SamWithReceiverCommandLineProcessor.ANNOTATION_OPTION.name, it) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user