From 594988db51d10498aece17737ac98b62fdc77e69 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Tue, 19 May 2015 20:35:47 +0300 Subject: [PATCH] Move kapt compiler plugin classes to BundledCompilerPlugins --- .../kotlin/cli/jvm/BundledCompilerPlugins.kt | 32 +++++++++++++++++++ .../kotlin/cli/jvm/PluginCliParser.kt | 6 ++-- 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/BundledCompilerPlugins.kt diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/BundledCompilerPlugins.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/BundledCompilerPlugins.kt new file mode 100644 index 00000000000..9e91c3af90e --- /dev/null +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/BundledCompilerPlugins.kt @@ -0,0 +1,32 @@ +/* + * Copyright 2010-2015 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.cli.jvm + +import org.jetbrains.kotlin.annotation.AnnotationCollectorCommandLineProcessor +import org.jetbrains.kotlin.annotation.AnnotationCollectorComponentRegistrar +import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor +import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar + +object BundledCompilerPlugins { + + val componentRegistrars: List + get() = listOf(AnnotationCollectorComponentRegistrar()) + + val commandLineProcessors: List + get() = listOf(AnnotationCollectorCommandLineProcessor()) + +} \ No newline at end of file diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/PluginCliParser.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/PluginCliParser.kt index 31d5bf77fba..186edccb704 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/PluginCliParser.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/PluginCliParser.kt @@ -21,8 +21,6 @@ import java.util.jar.JarFile import java.util.jar.Attributes import java.util.regex.Pattern import com.intellij.util.containers.MultiMap -import org.jetbrains.kotlin.annotation.AnnotationCollectorCommandLineProcessor -import org.jetbrains.kotlin.annotation.AnnotationCollectorComponentRegistrar import java.net.URLClassLoader import java.net.URL import java.io.File @@ -48,7 +46,7 @@ public object PluginCliParser { ) val componentRegistrars = ServiceLoader.load(javaClass(), classLoader).toArrayList() - componentRegistrars.add(AnnotationCollectorComponentRegistrar()) + componentRegistrars.addAll(BundledCompilerPlugins.componentRegistrars) configuration.addAll(ComponentRegistrar.PLUGIN_COMPONENT_REGISTRARS, componentRegistrars) processPluginOptions(arguments, configuration, classLoader) @@ -65,7 +63,7 @@ public object PluginCliParser { } ?: mapOf() val commandLineProcessors = ServiceLoader.load(javaClass(), classLoader).toArrayList() - commandLineProcessors.add(AnnotationCollectorCommandLineProcessor()) + commandLineProcessors.addAll(BundledCompilerPlugins.commandLineProcessors) for (processor in commandLineProcessors) { val declaredOptions = processor.pluginOptions.valuesToMap { it.name }