DEFAULT
The formula used when no formula { } is present.
Layout: 1 | major(3) | minor(3) | patch(2) | rebuild(1).
1.4.0 -> 1001004000
1.4.0 rebuild 1 -> 1001004001
1.4.1 -> 1001004010
1.5.0 -> 1001005000Content copied to clipboard
Ten codes per version. The ceiling is 1999999999, comfortably under Play's 2100000000 cap. A version bump always outranks every rebuild of the version before it, so rebuild never needs resetting.
Limits: major and minor 0..999, patch 0..99, rebuild 0..9. Going over fails the build instead of producing a silently wrong number, and the message shows you how to bring your own formula.
Need 100 rebuilds per version? Move a digit, at the cost of capping major at 99:
// 1.4.0 -> 1010040000, 1.4.0 rebuild 42 -> 1010040042
formula { v ->
fun pad(value: Int, width: Int) = value.toString().padStart(width, '0')
"1${pad(v.major, 2)}${pad(v.minor, 3)}${pad(v.patch, 2)}${pad(v.reupload, 2)}".toInt()
}Content copied to clipboard