Kotlin Compiler

Compile Kotlin source with Elide

elide kotlinc runs the Kotlin compiler included with Elide. Elide 1.5.0 includes Kotlin 2.4.10.

The JVM toolchain (kotlinc, javac, ktfmt, and the compiler plugins such as Metro) ships as a separate native library, lib/libjvmtools.so (.dylib on macOS), inside the Elide distribution. It is loaded only when a toolchain command runs, or when elide run compiles a Kotlin or Java source file, so it adds nothing to the runtime’s startup or memory footprint. A distribution that omits the library is runtime-only: toolchain commands then report that the full distribution is required. Fully static (musl) builds embed the toolchain in the elide binary instead.

Compile source files

// Hello.kt
fun main() = println("Hello!")
elide kotlinc -- -d out Hello.kt
elide java -- -cp out HelloKt
Compiling and running Kotlin source with Elide

Options for Kotlin’s compiler go after --. Elide-specific options go before it. Use the two help surfaces to distinguish them:

elide kotlinc --help
elide kotlinc -- -help

Useful Elide options

OptionPurpose
--incrementalReuse incremental compiler state between invocations.
--incremental-cache-dir DIRChoose where incremental state is stored.
--plugins LISTEnable included compiler plugins explicitly.
--testsEnable the plugins used by test compilation.
--max-errors NLimit rendered diagnostics; 0 shows all.

More specialized worker and ABI options are shown by elide kotlinc --help. They are intended for build-system integrations rather than ordinary command line use.

Build projects

elide build compiles Kotlin source sets declared in elide.pkl. Keep project compiler settings in the manifest so local and CI builds use the same options.

See Elide Projects for source sets and build configuration.