Skip to content

kmp-targets

Dynamically select which Kotlin Multiplatform targets to build.

Build Maven Central License Kotlin

One Gradle property decides what your build registers. Targets you don't select are never registered with KGP, so their compile/link/KSP/publish tasks never exist.

# kmp-targets.properties (committed), kmp-targets.local.properties (personal), or -P
kmptargets.targets=jvm,iosArm64
// build.gradle.kts
plugins {
    kotlin("multiplatform")
    id("com.rsicarelli.kmptargets") version "0.1.0-SNAPSHOT"
}

kmpTargets {
    supports { mobile + web - iosX64 }   // presets and leaves compose as set algebra
}

The plugin registers selection ∩ supported per module: the module declares what it can build, the global selection decides what you want right now.

Status: alpha. Roadmap: user-defined hierarchy groups. Apple support now covers the framework helper, XCFramework assembly, and the opt-in Xcode environment selection source.

Documentation

  1. Quick Start — apply, declare, select, inspect
  2. Selection DSLsupports { }, set algebra, the JVM rename
  3. CI — one selection vocabulary across every CI host
  4. Design — rationale and trade-offs

Requirements

Consumer surface Floor
Gradle (kotlin-dsl build-logic) 8.11+
Daemon JVM JDK 17
Kotlin Gradle Plugin 2.2+

Full story: Compatibility.

License

kmp-targets is licensed under the Apache License 2.0.