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

io.koalaql.kapshot.plugin.CliProcessor.kt Maven / Gradle / Ivy

The newest version!
package io.koalaql.kapshot.plugin

import org.jetbrains.kotlin.compiler.plugin.AbstractCliOption
import org.jetbrains.kotlin.compiler.plugin.CliOption
import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.jetbrains.kotlin.config.CompilerConfiguration

/* this service is registered under resources/META-INF/services */
@OptIn(ExperimentalCompilerApi::class)
class CliProcessor: CommandLineProcessor {
    override val pluginId: String = "io.koalaql.kapshot-plugin"

    override val pluginOptions: Collection = listOf(
        CliOption(
            optionName = "projectDir",
            valueDescription = "path",
            description = "root project path",
            required = false,
        )
    )

    override fun processOption(
        option: AbstractCliOption,
        value: String,
        configuration: CompilerConfiguration
    ) {
        return when (option.optionName) {
            "projectDir" -> configuration.put(PROJECT_DIR_KEY, value)
            else -> throw IllegalArgumentException("Unexpected config option ${option.optionName}")
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy