Kotlin Extension for bld https://github.com/rife2/bld-kotlin
Find a file
Erik C. Thauvin 5a3c77a162
Update extensions dependencies
Bump Exec from 1.0.4 to 1.0.5
Bump PMD from 1.2.1 to 1.2.2
2025-03-28 07:53:08 -07:00
.github/workflows Combine project and examples jobs 2025-03-23 15:23:12 -07:00
.idea Add test for fromProject() using the examples project 2025-03-21 21:04:34 -07:00
.vscode Bump bld to version 2.2.1 2025-02-25 09:43:06 -08:00
config Updated dependencies 2024-10-27 16:58:52 -07:00
examples Minor cleanups 2025-03-25 00:00:06 -07:00
lib/bld Update extensions dependencies 2025-03-28 07:53:08 -07:00
scripts Bump Kotlin to version 2.1.20 2025-03-21 01:04:42 -07:00
src Log where the kotlin compiler was found from/at 2025-03-26 21:52:12 -07:00
.gitignore Fixed dependencies for testing 2023-11-04 02:07:00 -07:00
bld Initial commit 2023-11-03 21:31:09 -07:00
bld.bat Initial commit 2023-11-03 21:31:09 -07:00
LICENSE.txt Initial commit 2023-11-03 21:31:09 -07:00
README.md Reorder the common kotlin compiler potential locations 2025-03-21 21:24:44 -07:00

Kotlin Extension for bld

License Java Kotlin bld Release Snapshot GitHub CI

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.

Compile Kotlin Source Code

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.

Kotlin Compiler Requirement

Please make sure the Kotlin compiler is installed.

The extension will look in common locations such as:

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.

Template Project

There is also a Template Project with support for the Dokka and Detekt extensions.