Localize plugin string format usages
This commit is contained in:
@@ -37,12 +37,12 @@ import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
|
||||
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
|
||||
|
||||
|
||||
public object PluginCliParser {
|
||||
|
||||
public val PLUGIN_ARGUMENT_PREFIX: String = "plugin:"
|
||||
|
||||
[platformStatic]
|
||||
fun loadPlugins(arguments: CommonCompilerArguments, configuration: CompilerConfiguration) {
|
||||
val classLoader = PluginURLClassLoader(
|
||||
@@ -100,24 +100,6 @@ public object PluginCliParser {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class PluginOptionValue(
|
||||
val pluginId: String,
|
||||
val optionName: String,
|
||||
val value: String
|
||||
) {
|
||||
override fun toString() = "$pluginId:$optionName=$value"
|
||||
}
|
||||
|
||||
private 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
|
||||
}
|
||||
}
|
||||
|
||||
private class PluginURLClassLoader(urls: Array<URL>, parent: ClassLoader) : ClassLoader(Thread.currentThread().getContextClassLoader()) {
|
||||
|
||||
Reference in New Issue
Block a user