VersionCodeScheme

fun interface VersionCodeScheme

Turns a release version into a build number.

You write it once, as version { scheme { ... } }, and a platform block can replace it for itself. The result is text, because the stores disagree about what a build number looks like: Android wants one decimal integer, Apple accepts up to three dot-separated numbers.

kiteConfig {
version = "1.4.0"
version {
// 1.4.0 -> "1040000", 1.4.1 -> "1040100"
scheme { v -> (1_000_000 * v.major + 10_000 * v.minor + 100 * v.patch + v.rebuild).toString() }
}
}

Each platform validates the text it receives. Android parses it as an integer and holds it to the store's range, and Google Play never forgets a number, so a code can never shrink. Changing the scheme of a published app is safe only when every new number beats every number already shipped.

Functions

Link copied to clipboard
abstract fun compute(version: ConfigVersion): String

Returns the build number for version, as the text the platform will receive.