All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kotlinx.rpc.codegen.extension.RPCIrExtension.kt Maven / Gradle / Ivy

There is a newer version: 2.0.21-0.4.0
Show newest version
/*
 * Copyright 2023-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
 */

package kotlinx.rpc.codegen.extension

import kotlinx.rpc.codegen.VersionSpecificApi
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment

class RPCIrExtension(configuration: CompilerConfiguration) : IrGenerationExtension {
    private val logger = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE)

    override fun generate(
        moduleFragment: IrModuleFragment,
        pluginContext: IrPluginContext,
    ) {
        val context = RPCIrContext(pluginContext, VersionSpecificApi.INSTANCE)

        val processor = RPCIrServiceProcessor(logger)
        moduleFragment.transform(processor, context)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy