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

org.jetbrains.kotlinx.jupyter.compiler.DefaultCompilerArgsConfigurator.kt Maven / Gradle / Ivy

Go to download

Implementation of REPL compiler and preprocessor for Jupyter dialect of Kotlin (IDE-compatible)

There is a newer version: 0.12.0-290
Show newest version
package org.jetbrains.kotlinx.jupyter.compiler

import jupyter.kotlin.CompilerArgs
import jupyter.kotlin.JavaRuntime
import kotlin.script.experimental.api.ResultWithDiagnostics
import kotlin.script.experimental.api.ScriptCompilationConfiguration
import kotlin.script.experimental.api.asSuccess

class DefaultCompilerArgsConfigurator(
    jvmTargetVersion: String = JavaRuntime.version,
) : CompilerArgsConfigurator {
    private val argsList =
        mutableListOf(
            "-jvm-target",
            jvmTargetVersion,
            "-no-stdlib",
        )

    override fun getArgs(): List {
        return argsList.toList()
    }

    override fun configure(
        configuration: ScriptCompilationConfiguration,
        annotations: List,
    ): ResultWithDiagnostics {
        annotations.forEach {
            when (it) {
                is CompilerArgs -> argsList.addAll(it.values)
            }
        }

        return configuration.asSuccess()
    }

    override fun addArg(arg: String) {
        argsList.add(arg)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy