Remove deprecated usages of CliOption in official compiler plugins

This commit is contained in:
Yan Zhulanow
2018-10-29 09:16:09 +09:00
parent 49941339a3
commit c5e241d5c6
18 changed files with 44 additions and 61 deletions
@@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentMap
class IdeNoArgDeclarationChecker(val project: Project) : AbstractNoArgDeclarationChecker() {
private companion object {
val ANNOTATION_OPTION_PREFIX = "plugin:$PLUGIN_ID:${ANNOTATION_OPTION.name}="
val ANNOTATION_OPTION_PREFIX = "plugin:$PLUGIN_ID:${ANNOTATION_OPTION.optionName}="
}
private val cache: CachedValue<ConcurrentMap<Module, List<String>>> = cachedValue(project) {
@@ -17,7 +17,6 @@
package org.jetbrains.kotlin.noarg.ide
import org.jetbrains.kotlin.annotation.plugin.ide.AbstractGradleImportHandler
import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup
import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup.PluginOption
import org.jetbrains.kotlin.noarg.NoArgCommandLineProcessor
import org.jetbrains.kotlin.utils.PathUtil
@@ -25,13 +24,13 @@ import org.jetbrains.kotlin.utils.PathUtil
class NoArgGradleProjectImportHandler : AbstractGradleImportHandler<NoArgModel>() {
override val compilerPluginId = NoArgCommandLineProcessor.PLUGIN_ID
override val pluginName = "noarg"
override val annotationOptionName = NoArgCommandLineProcessor.ANNOTATION_OPTION.name
override val annotationOptionName = NoArgCommandLineProcessor.ANNOTATION_OPTION.optionName
override val pluginJarFileFromIdea = PathUtil.kotlinPathsForIdeaPlugin.noArgPluginJarPath
override val modelKey = NoArgProjectResolverExtension.KEY
override fun getAdditionalOptions(model: NoArgModel): List<PluginOption> {
return listOf(PluginOption(
NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.name,
NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.optionName,
model.invokeInitializers.toString()))
}
@@ -23,8 +23,8 @@ import org.jetbrains.kotlin.utils.PathUtil
class NoArgMavenProjectImportHandler : AbstractMavenImportHandler() {
private companion object {
val ANNOTATATION_PARAMETER_PREFIX = "no-arg:${NoArgCommandLineProcessor.ANNOTATION_OPTION.name}="
val INVOKEINITIALIZERS_PARAMETER_PREFIX = "no-arg:${NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.name}="
val ANNOTATATION_PARAMETER_PREFIX = "no-arg:${NoArgCommandLineProcessor.ANNOTATION_OPTION.optionName}="
val INVOKEINITIALIZERS_PARAMETER_PREFIX = "no-arg:${NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.optionName}="
}
override val compilerPluginId = NoArgCommandLineProcessor.PLUGIN_ID
@@ -49,14 +49,14 @@ class NoArgMavenProjectImportHandler : AbstractMavenImportHandler() {
text.substring(ANNOTATATION_PARAMETER_PREFIX.length)
})
val options = annotations.mapTo(mutableListOf()) { PluginOption(NoArgCommandLineProcessor.ANNOTATION_OPTION.name, it) }
val options = annotations.mapTo(mutableListOf()) { PluginOption(NoArgCommandLineProcessor.ANNOTATION_OPTION.optionName, it) }
val invokeInitializerOptionValue = compilerPluginOptions
.firstOrNull { it.startsWith(INVOKEINITIALIZERS_PARAMETER_PREFIX) }
?.drop(INVOKEINITIALIZERS_PARAMETER_PREFIX.length) == "true"
if (invokeInitializerOptionValue) {
options.add(PluginOption(NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.name, "true"))
options.add(PluginOption(NoArgCommandLineProcessor.INVOKE_INITIALIZERS_OPTION.optionName, "true"))
}
return options