diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/PluginCliParser.kt b/compiler/cli/src/org/jetbrains/jet/cli/jvm/PluginCliParser.kt index 9eb9898e165..1a11fce9244 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/jvm/PluginCliParser.kt +++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/PluginCliParser.kt @@ -38,7 +38,7 @@ import java.util.ServiceLoader import java.io.IOException import java.util.Enumeration import org.jetbrains.kotlin.compiler.plugin.parsePluginOption -import org.jetbrains.kotlin.compiler.plugin.PluginOptionValue +import org.jetbrains.kotlin.compiler.plugin.CliOptionValue public object PluginCliParser { @@ -75,7 +75,7 @@ public object PluginCliParser { for (processor in commandLineProcessors) { val declaredOptions = processor.pluginOptions.valuesToMap { it.name } - val optionsToValues = MultiMap() + val optionsToValues = MultiMap() for (optionValue in optionValuesByPlugin[processor.pluginId].orEmpty()) { val option = declaredOptions[optionValue!!.optionName] diff --git a/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CliOptions.kt b/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CliOptions.kt new file mode 100644 index 00000000000..f317b5d7f5a --- /dev/null +++ b/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CliOptions.kt @@ -0,0 +1,52 @@ +/* + * Copyright 2010-2014 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.compiler.plugin + +import org.jetbrains.jet.config.CompilerConfiguration +import java.util.regex.Pattern + +public class CliOption( + public val name: String, + public val valueDescription: String, + public val description: String, + public val required: Boolean = true, + public val allowMultipleOccurrences: Boolean = false +) + +public class CliOptionProcessingException(message: String, cause: Throwable? = null): RuntimeException(message, cause) + +public data class CliOptionValue( + val pluginId: String, + val optionName: String, + val value: String +) { + override fun toString() = "$pluginId:$optionName=$value" +} + +public fun parsePluginOption(argumentValue: String): CliOptionValue? { + val pattern = Pattern.compile("""^plugin:([^:]*):([^=]*)=(.*)$""") + val matcher = pattern.matcher(argumentValue) + if (matcher.matches()) { + return CliOptionValue(matcher.group(1), matcher.group(2), matcher.group(3)) + } + + return null +} + +public fun getPluginOptionString(pluginId: String, key: String, value: String): String { + return "plugin:$pluginId:$key=$value" +} \ No newline at end of file diff --git a/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CommandLineProcessor.kt b/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CommandLineProcessor.kt index 4c10037de09..0f84f4331ae 100644 --- a/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CommandLineProcessor.kt +++ b/compiler/plugin-api/src/org/jetbrains/kotlin/compiler/plugin/CommandLineProcessor.kt @@ -17,17 +17,6 @@ package org.jetbrains.kotlin.compiler.plugin import org.jetbrains.jet.config.CompilerConfiguration -import java.util.regex.Pattern - -public class CliOption( - public val name: String, - public val valueDescription: String, - public val description: String, - public val required: Boolean = true, - public val allowMultipleOccurrences: Boolean = false -) - -public class CliOptionProcessingException(message: String, cause: Throwable? = null): RuntimeException(message, cause) public trait CommandLineProcessor { public val pluginId: String @@ -35,26 +24,4 @@ public trait CommandLineProcessor { [throws(javaClass())] public fun processOption(option: CliOption, value: String, configuration: CompilerConfiguration) -} - -public data class PluginOptionValue( - val pluginId: String, - val optionName: String, - val value: String -) { - override fun toString() = "$pluginId:$optionName=$value" -} - -public fun parsePluginOption(argumentValue: String): PluginOptionValue? { - val pattern = Pattern.compile("""^plugin:([^:]*):([^=]*)=(.*)$""") - val matcher = pattern.matcher(argumentValue) - if (matcher.matches()) { - return PluginOptionValue(matcher.group(1), matcher.group(2), matcher.group(3)) - } - - return null -} - -public fun getPluginOptionString(pluginId: String, key: String, value: String): String { - return "plugin:$pluginId:$key=$value" } \ No newline at end of file