Fix 'CommandLineProcessor' extension point calling, switch it to using ServiceLoaderLite

This commit is contained in:
Yan Zhulanow
2018-12-27 16:58:17 +03:00
committed by Yan Zhulanow
parent 34818b0bbe
commit 7d660834e1
@@ -76,7 +76,7 @@ object PluginCliParser {
private fun processPluginOptions( private fun processPluginOptions(
pluginOptions: Iterable<String>?, pluginOptions: Iterable<String>?,
configuration: CompilerConfiguration, configuration: CompilerConfiguration,
classLoader: ClassLoader classLoader: URLClassLoader
) { ) {
val optionValuesByPlugin = pluginOptions?.map(::parsePluginOption)?.groupBy { val optionValuesByPlugin = pluginOptions?.map(::parsePluginOption)?.groupBy {
if (it == null) throw CliOptionProcessingException("Wrong plugin option format: $it, should be ${CommonCompilerArguments.PLUGIN_OPTION_FORMAT}") if (it == null) throw CliOptionProcessingException("Wrong plugin option format: $it, should be ${CommonCompilerArguments.PLUGIN_OPTION_FORMAT}")
@@ -84,7 +84,7 @@ object PluginCliParser {
} ?: mapOf() } ?: mapOf()
// TODO issue a warning on using deprecated command line processors when all official plugin migrate to the newer convention // TODO issue a warning on using deprecated command line processors when all official plugin migrate to the newer convention
val commandLineProcessors = ServiceLoader.load(CommandLineProcessor::class.java, classLoader) val commandLineProcessors = ServiceLoaderLite.loadImplementations(CommandLineProcessor::class.java, classLoader)
for (processor in commandLineProcessors) { for (processor in commandLineProcessors) {
val declaredOptions = processor.pluginOptions.associateBy { it.optionName } val declaredOptions = processor.pluginOptions.associateBy { it.optionName }