Targets
Status: 🟢 JVM. 🟡 Android, JavaScript, and Native have compiler backends but are not reachable from a multi-target build yet. ⚪ WebAssembly. See Implementation Status.
A target is a platform you compile for. Declare them in [targets]; every name
below is accepted in kebab-case or camelCase (ios-arm64 and iosArm64 are the
same target).
Every target
| Name | Platform | Status |
|---|---|---|
jvm | Kotlin/JVM | 🟢 |
android | Kotlin/JVM for Android | 🟡 |
js | Kotlin/JS | 🟡 |
wasm-js | Kotlin/Wasm, browser | ⚪ |
wasm-wasi | Kotlin/Wasm, WASI | ⚪ |
ios-arm64 | iOS device | 🟡 |
ios-simulator-arm64 | iOS simulator, Apple silicon | 🟡 |
ios-x64 | iOS simulator, Intel | 🟡 |
macos-arm64 | macOS, Apple silicon | 🟡 |
macos-x64 | macOS, Intel | 🟡 |
linux-x64 | Linux, x86_64 | 🟡 |
linux-arm64 | Linux, ARM64 | 🟡 |
mingw-x64 | Windows, x86_64 | 🟡 |
tvos-arm64 | tvOS device | 🟡 |
tvos-simulator-arm64 | tvOS simulator | 🟡 |
watchos-arm64 | watchOS device | 🟡 |
watchos-simulator-arm64 | watchOS simulator | 🟡 |
android-native-arm64 | Android NDK, ARM64 | 🟡 |
android-native-x64 | Android NDK, x86_64 | 🟡 |
jvm
[targets.jvm]
java-target = "25"
| Option | Default | Description |
|---|---|---|
java-target | 25 | Bytecode level. "17", "21", "25". |
Output: a JAR in build/jvm/<profile>/output/. Source sets: src/main/kotlin for
single-target projects, src/jvmMain/kotlin for multiplatform ones.
java-target is independent of the JDK you compile with — build on JDK 25 and emit
Java 17 bytecode if that is what you deploy onto.
android
[targets.android]
min-sdk = 24
target-sdk = 36
compile-sdk = 36
java-target = "17"
| Option | Default | Description |
|---|---|---|
min-sdk | 24 | Minimum supported API level. |
target-sdk | 36 | API level the app is tested against. |
compile-sdk | 36 | API level compiled against. |
java-target | 25 | Bytecode level. |
min-sdk <= target-sdk is validated. Kargo locates the Android SDK via
[toolchain], ANDROID_SDK in .kargo.env, ANDROID_HOME, or
ANDROID_SDK_ROOT, and installs the required platform if missing.
android.* resolves against the compile-sdk platform. If it is not
installed, Kargo says so and names the kargo toolchain install --android
that fixes it.
.aar dependencies work like jars. AndroidX is published only to Google's
Maven, so declare it:
[repositories]
google = "https://maven.google.com"
Status: 🟡 Compiles Kotlin against the Android SDK and
.aardependencies. Resource compilation, manifest merging, and APK or AAB packaging are planned.
javascript
[targets.js]
module-kind = "es"
| Option | Values | Default | Description |
|---|---|---|---|
module-kind | es, commonjs | es | Module format emitted. |
Use es for bundlers and modern browsers, commonjs for older Node tooling.
Output: .js plus .d.ts declarations. Node.js is needed to run JS tests.
native
The Kotlin/Native family: ios-*, macos-*, linux-*, mingw-x64, tvos-*,
watchos-*, android-native-*.
[targets]
ios-arm64 = {}
ios-simulator-arm64 = {}
macos-arm64 = {}
linux-x64 = {}
No per-target options besides cinterop. Output is a .framework
for Apple targets, an executable or shared library elsewhere.
Host requirements. Kotlin/Native does not cross-compile between operating systems:
| Target family | Required host |
|---|---|
ios-*, macos-*, tvos-*, watchos-* | macOS with Xcode |
linux-* | Linux |
mingw-x64 | Windows |
android-native-* | Linux or macOS, with the NDK |
This is a Kotlin/Native constraint, not a Kargo one. Plan CI matrices around it — see Continuous Integration.
cinterop
Status: ⚪ Planned.
[target.ios-arm64.cinterop.mylib]
def-file = "src/nativeInterop/cinterop/mylib.def"
headers = ["include/mylib.h"]
compiler-opts = ["-Iinclude"]
linker-opts = ["-L/usr/local/lib", "-lmylib"]
| Key | Type | Description |
|---|---|---|
def-file | string | The .def describing the library. Required. |
headers | list | Headers to process. |
compiler-opts | list | Flags for the C compiler. |
linker-opts | list | Flags for the linker. |
webassembly
Status: ⚪ Planned.
[targets]
wasm-js = {}
wasm-wasi = {}
wasm-js targets browsers with JavaScript interop; wasm-wasi targets WASI
runtimes. Output is a .wasm module plus glue code for wasm-js.
Choosing a target name
For iOS, declare both ios-arm64 (device) and ios-simulator-arm64 (simulator)
— you need both to develop and ship, and shared code goes in src/iosMain via
the source-set hierarchy.
Add ios-x64 only if you still support Intel Macs for simulator builds.
Source-set mapping
| Target | Target-specific source set | Shared with |
|---|---|---|
jvm | src/jvmMain/kotlin | commonMain |
android | src/androidMain/kotlin | commonMain |
js | src/jsMain/kotlin | jsAndWasmMain, commonMain |
ios-arm64 | src/iosArm64Main/kotlin | iosMain, appleMain, nativeMain, commonMain |
linux-x64 | src/linuxX64Main/kotlin | nativeMain, commonMain |
Full rules in Source Sets.