[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
+8
-6
@@ -5,14 +5,16 @@
|
||||
|
||||
package org.jetbrains.kotlin.importsDumper
|
||||
|
||||
import com.intellij.mock.MockProject
|
||||
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
|
||||
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
|
||||
|
||||
class ImportsDumperComponentRegistrar : ComponentRegistrar {
|
||||
override fun registerProjectComponents(project: MockProject, configuration: CompilerConfiguration) {
|
||||
class ImportsDumperComponentRegistrar : CompilerPluginRegistrar() {
|
||||
override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) {
|
||||
val destinationPath = configuration[ImportsDumperConfigurationKeys.DESTINATION] ?: return
|
||||
AnalysisHandlerExtension.registerExtension(project, ImportsDumperExtension(destinationPath))
|
||||
AnalysisHandlerExtension.registerExtension(ImportsDumperExtension(destinationPath))
|
||||
}
|
||||
}
|
||||
|
||||
override val supportsK2: Boolean
|
||||
get() = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user