KiteConfigBuildConfigExtension

Generated Kotlin constants for your shared code, inside kiteConfig { buildConfig { ... } }.

kiteConfig {
appName = "Jetzy"
version = "1.4.0"
id = "com.example.jetzy"
modules { shared = ":shared" }

buildConfig {
packageName = "com.example.jetzy.generated"

stringField("BASE_URL", "https://api.acme.com")
intField("API_TIMEOUT_MS", 30_000)
booleanField("ANALYTICS_ENABLED", true)
}
}

Opening this block turns generation on. KiteConfig writes one Kotlin object into the shared project's commonMain, so every platform reads the same constants without an expect and actual pair.

App identity rides along by default: app name, version, version code, Android application ID, iOS bundle ID, and locales. See includeIdentity to turn that off. Android SDK and toolchain values are never included; declare a custom field when runtime code needs one.

The generated file lives in a plugin-owned build directory and never enters your hand-written source tree. Package, object, and field names must be valid Kotlin names.

This is not a secret store. Only public client configuration belongs here. A provider can keep a value out of the build script and out of version control, but the resolved value still reaches generated source and Gradle task inputs. It can also surface in build scans, KLIBs, APKs, IPAs, decompiled binaries, and a trusted build cache when allowBuildCache is on. Never add passwords, private API keys, signing material, or other credentials.

Field helpers

HelperGenerates
stringField(name, value)public const val name: String
intField / longField / doubleFieldthe matching numeric const val
booleanField(name, value)public const val name: Boolean
stringField(name, provider)same, resolved lazily at task time

Only stringField accepts a Provider. Give it a fallback: an absent provider fails the build naming the field, rather than emptying the whole set.

stringField("CHANNEL", providers.gradleProperty("channel").orElse("stable"))

What generation requires

RequirementWhy
a shared modulethat is where commonMain lives
that module applies Kotlin Multiplatformthe object is generated into a KMP source set
complete identity, when includeIdentity is onthe object would otherwise emit half an identity

See also

for selecting the module explicitly.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
abstract val allowBuildCache: Property<Boolean>

Whether Gradle may store the generated source in a build cache.

Link copied to clipboard
abstract val className: Property<String>

Name of the generated object. It must be a valid Kotlin identifier.

Link copied to clipboard
abstract val fields: ListProperty<String>

Legacy list representation for custom fields.

Link copied to clipboard
abstract val includeIdentity: Property<Boolean>

Whether KiteConfig app identity is baked into the object: app name, version, version code, the resolved Android and iOS IDs, and the canonical locales.

Link copied to clipboard
abstract val packageName: Property<String>

Kotlin package of the generated object, written as dot-separated identifiers such as com.acme.app.generated.

Functions

Link copied to clipboard
fun booleanField(name: String, value: Boolean)

Add a validated Kotlin Boolean constant.

Link copied to clipboard
fun doubleField(name: String, value: Double)

Add a validated finite Kotlin Double constant. NaN and infinite values are rejected.

Link copied to clipboard
fun intField(name: String, value: Int)

Add a validated Kotlin Int constant. Int.MIN_VALUE is emitted as valid Kotlin source.

Link copied to clipboard
fun longField(name: String, value: Long)

Add a validated Kotlin Long constant. Long.MIN_VALUE is emitted as valid Kotlin source.

Link copied to clipboard
fun stringField(name: String, value: String)

Add a validated Kotlin String constant of at most 10,000 characters.

fun stringField(name: String, value: Provider<String>)

Add a validated Kotlin String constant from a provider.