A Boot task that provides compilation of Kotlin source files.
Create a Kotlin program in src/kt
:
fun main(args: Array<String>) {
println("Hello World!")
}
Now you can compile it and access the compiled class from the REPL:
> boot -d seancorfield/boot-kotlinc kotlinc repl
...
boot.user> (import HelloKt)
HelloKt
boot.user> (HelloKt/main (into-array String []))
Hello World!
nil
boot.user>
Or you can compile it and make an uberjar:
> boot -d seancorfield/boot-kotlinc kotlinc uber jar -m HelloKt target
Adding uberjar entries...
Writing project.jar...
Writing target dir(s)...
> java -jar target/project.jar
Hello World!
You can specify -v
for verbose mode. This will print out how boot-kotlinc
is invoking the Kotlin compiler (showing the classpath and other options), as well as telling the Kotlin compiler itself to be verbose.
You can override the default location for Kotlin source code (src/kt
) with the -k
or --source
option. You can specify this multiple times for multiple source locations.
The -t
or --test
option will add a dependency on org.jetbrains.kotline/kotlin-test
and will also add test/kt
as a default source location, if -k
or --source
was not specified. In other words, the following Boot invocations are equivalent:
> boot -d seancorfield/boot-kotlinc kotlinc -t repl
> boot -d seancorfield/boot-kotlinc \
-d org.jetbrains.kotlin/kotlin-test \
-k src/kt -k test/kt kotlinc repl
boot-kotlinc
in your own build.boot
file, how to write mixed Clojure/Kotlin projects, etc..class
files in a specific output directory).-t
/ --test
option-k
/ --source
options)Copyright © 2017 Sean Corfield.
Distributed under the Eclipse Public License version 1.0.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close