Build Pipeline
When JNI is enabled, Kreate wires a fully automated native build pipeline into your Gradle build. This page describes the individual tasks, their execution order, and how the compiled library is made available at runtime.
Task Graph
kreate-jni-build is hooked into the Kotlin compile pipeline via executeTaskBeforeCompile, ensuring the shared library is always rebuilt before Kotlin compilation begins.
kreate-jni-initialize
Scaffolds the native C++ project if it does not exist. See Project Scaffolding for the full details on what is generated.
Property | Value |
|---|---|
Task type |
|
Input |
|
Output |
|
Runs | Before |
kreate-jni-build
Invokes CMake in two steps to configure and build the shared library.
Step 1 — Configure:
Step 2 — Build:
The build type defaults to Release. The compiled shared library (.so/.dylib/.dll) is placed in <projectDirectory>/<projectName>/build/.
Property | Value |
|---|---|
Task type |
|
Input |
|
Output |
|
Default build type |
|
Runs | Before every |
Runtime Library Path
After the native build, Kreate automatically configures all Test and JavaExec tasks with the correct java.library.path so that System.loadLibrary() resolves the shared library without any manual setup.
The following JVM argument is injected:
Both task types also gain an explicit dependsOn("kreate-jni-build") dependency, ensuring the library is compiled before any test or run task executes.