Three-part version names for the car build
The unstable flavor appended upstream's CI build number as a fourth part (2.8.0.0-unstable; always .0 without CI). Versions are now the plain three-part defaultConfig version: 2.8.1-unstable, and build-car names the APK NilsMG4-unstable-2.8.1.apk. The version code keeps the x100000 factor (2.8.1 = 6700000): without it the code would fall below the 6600000 already installed, and the installer refuses downgrades. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
This commit is contained in:
+12
-16
@@ -34,8 +34,8 @@ android {
|
||||
applicationId "com.stinnesbeck.nilsmg4"
|
||||
minSdk 27
|
||||
targetSdk 36
|
||||
versionCode 66
|
||||
versionName "2.8.0"
|
||||
versionCode 67
|
||||
versionName "2.8.1"
|
||||
|
||||
// Nothing about the server ships in the APK: its URL and ingest token are entered in
|
||||
// the app's Server tab (ServerConfig), and the database is only reachable by the server.
|
||||
@@ -61,16 +61,13 @@ android {
|
||||
unstable {
|
||||
dimension "channel"
|
||||
applicationIdSuffix ".unstable"
|
||||
// Android uses versionCode, not versionName, to order package updates. Give
|
||||
// every rolling CI build a strictly increasing code so Package Installer does
|
||||
// not treat a newer unstable APK as the same package version.
|
||||
versionCode defaultConfig.versionCode * 100000 +
|
||||
(project.findProperty('unstableBuild') ?: '0').toString().toInteger()
|
||||
// Le numéro de build fait partie du COEUR numérique de la version
|
||||
// ("1.0.42-unstable"), pas du suffixe : l'updater compare des segments
|
||||
// numériques, donc deux builds unstable doivent différer avant le premier tiret.
|
||||
// -PunstableBuild=<n> est passé par la CI ; 0 en local.
|
||||
versionName "${defaultConfig.versionName}.${project.findProperty('unstableBuild') ?: '0'}"
|
||||
// Three-part versions, the same as defaultConfig ("2.8.1-unstable"). Upstream added
|
||||
// a fourth part for its CI build number; there is no CI here and the OTA updater is
|
||||
// off. The version code keeps upstream's x100000 so it never drops below codes
|
||||
// already installed on the car (2.8.0.0 was 6600000): a lower code is a downgrade,
|
||||
// which the installer refuses.
|
||||
versionCode defaultConfig.versionCode * 100000
|
||||
versionName defaultConfig.versionName
|
||||
versionNameSuffix "-unstable"
|
||||
buildConfigField "boolean", "OTA_ENABLED", "true"
|
||||
}
|
||||
@@ -106,12 +103,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
// Version publiée par la CI pour composer le nom de l'asset APK : ce nom DOIT être
|
||||
// comparable par l'updater ("NilsMG4-unstable-1.0.42.apk"). Le tag de la
|
||||
// pré-release est la constante "unstable", écrasée à chaque build.
|
||||
// The version build-car puts in the APK's file name ("NilsMG4-unstable-2.8.1.apk"), which
|
||||
// is also the name the OTA updater reads a release's version from.
|
||||
tasks.register('printUnstableVersion') {
|
||||
doLast {
|
||||
println "${android.defaultConfig.versionName}.${project.findProperty('unstableBuild') ?: '0'}"
|
||||
println android.defaultConfig.versionName
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user