io.github.gmazzo.codeowners.compiler.CodeOwnersIrGenerationExtension.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-compiler Show documentation
Show all versions of kotlin-compiler Show documentation
CodeOwners Kotlin Compiler Plugin
The newest version!
package io.github.gmazzo.codeowners.compiler
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
internal class CodeOwnersIrGenerationExtension(
private val mappings: CodeOwnersMappings,
) : IrGenerationExtension {
override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) {
mappings.noteFrontedFinished()
val transformer = CodeOwnersIrTransformer(pluginContext, mappings)
moduleFragment.accept(transformer, InvalidOwners)
}
private data object InvalidOwners : Set by emptySet() {
override val size: Int get() = error("Invalid owners")
}
}