To install the latest version, add the following to the lib/bld/bld-wrapper.properties
file:
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin
For more information, please refer to the extensions and support documentation.
To compile the source code located in src/main/kotlin
and src/test/kotlin
from the current project add the following to the build file:
@BuildCommand(summary = "Compiles the Kotlin project")
public void compile() throws Exception {
new CompileKotlinOperation()
.fromProject(this)
.execute();
}
./bld compile
Please check the Compile Operation documentation for all available configuration options.
Please make sure the Kotlin compiler is installed.
The extension will look in common locations such as:
KOTLIN_HOME
PATH
- SDKMAN!
- Homebrew
- JetBrains Toolbox (IntelliJ IDEA, Android Studio)
- etc.
You can also manually configure the Kotlin home location as follows:
@BuildCommand(summary = "Compiles the Kotlin project")
public void compile() throws Exception {
new CompileKotlinOperation()
.fromProject(this)
.kotlinHome("path/to/kotlin")
.execute();
}
The Kotlin compiler executable can also be specified directly:
@BuildCommand(summary = "Compiles the Kotlin project")
public void compile() throws Exception {
new CompileKotlinOperation()
.fromProject(this)
.kotlinc("/usr/bin/kotlinc")
.execute();
}
While older version of Kotlin are likely working with the extension, only version 1.9.25 or higher are officially supported.
There is also a Template Project with support for the Dokka and Detekt extensions.