Documentation for mill-kotlin, a mill plugin to support the Kotlin language and compiler.
Mill version 0.6.0 or newer is required.
import mill._
import mill.scalalib._
import mill.define._
// Load the plugin from Maven Central via ivy/coursier
import $ivy.`de.tototec::de.tobiasroeser.mill.kotlin:0.0.2`, de.tobiasroeser.mill.kotlin._
object main extends KotlinModule {
// Select the Kotlin version
def kotlinVersion = T{ "1.3.61" }
// Set additional Kotlin compiler options, e.g. the language level and annotation processor
// Run `mill main.kotlincHelp` to get a list of supported options
def kotlincOptions = Seq("-verbose")
}To target the JVM (kotlin-jvm), our module needs to extend de.tobiasroeser.mill.kotlin.KotlinModule which itself extends mill.scalalib.JavaModule.
For convenience, you may derive your unit test projects from de.tobiasroeser.mill.kotlin.KotlinModule.Tests trait.
The module trait de.tobiasroeser.mill.kotlin.KotlinModule has the following configuration options (over those from mill.scalalib.JavaModule).
def kotlinVersion: T[String]-
The Kotlin version to be used (for API and Language level settings).
def kotlinCompilerVersion: T[String]-
The version of the Kotlin compiler to be used. Default is derived from
kotlinVersion. def compile: T[CompilationResult]-
Compiles all the sources to JVM class files.
def kotlincOptions: T[Seq[String]]-
Additional Kotlin compiler options to be use by
compile. def ivyDeps: T[Agg[Dep]]-
The compile and runtime dependencies.
def kotlincHelp(args: String*): Command[Unit]-
Runs the Kotlin compiler with the
-helpargument to show you the built-in cmdline help. You might want to add additional arguments like-Xto see extra help. def kotlinCompilerIvyDeps: T[Agg[Dep]]-
The Ivy/Coursier dependencies resembling the Kotlin compiler. Default is derived from
kotlinCompilerVersion. def kotlinCompilerClasspath: T[Seq[PathRef]]-
The Java classpath resembling the Kotlin compiler. Default is derived from
kotlinCompilerIvyDeps. trait Tests extends TestModule with KotlinTestModule-
A test sub-module linked to its parent module best suited for unit-tests.
Mill is still in active development, and has no stable API yet. Hence, not all mill-kotlin versions work with every mill version.
The following table shows a matrix of compatible mill and mill-kotlin versions.
| mill-kotlin | mill |
|---|---|
master |
0.6.0 - 0.6.1 |
0.0.2 |
0.5.7 |
0.0.1 |
0.5.7 |
You can download binary releases from Maven Central.
Thanks to iba Consulting Gesellschaft mbH & Co KG for the initial development support.
- mill
-
Mill is a Scala-based open source build tool. In my opinion the best build tool for the JVM. It is fast, reliable and easy to understand.
- me
-
I’m a professional software developer and love to do open source. I’m actively developing and maintaining mill as well as several mill plugins.
If you like my work, please star it on GitHub. You can also support me via GitHub Sponsors.
- Contributing
-
If you found a bug or have a feature request, please open a new issue on GitHub. I also accept pull requests on GitHub.
-
Fixed non-functional
kotlincHelptarget
See milstone 0.0.2 and the list of commits