[Plugins] Introduce new API for registering compiler plugins
Original `ComponentRegistrar` exposes Project to its registration method, so plugins should manually register extensions to it. To prepare for possible unbound compiler from Project API in future new `K2ComponentRegistrar` introduced which provides registration method without Project at all
This commit is contained in:
committed by
teamcity
parent
bb996c1b27
commit
8b42638afa
+5
-2
@@ -30,12 +30,15 @@ class TestCommandLineProcessor : CommandLineProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
class TestKotlinPluginRegistrar : ComponentRegistrar {
|
||||
override fun registerProjectComponents(project: MockProject, configuration: CompilerConfiguration) {
|
||||
class TestKotlinPluginRegistrar : CompilerPluginRegistrar() {
|
||||
override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) {
|
||||
val collector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)!!
|
||||
val option = configuration.get(TestPluginKeys.TestOption)!!
|
||||
|
||||
collector.report(CompilerMessageSeverity.INFO, "Plugin applied")
|
||||
collector.report(CompilerMessageSeverity.INFO, "Option value: $option")
|
||||
}
|
||||
|
||||
override val supportsK2: Boolean
|
||||
get() = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user