ソースを参照

fix: version name suffix in debug (#290)

Reviewed-on: https://gitea.angry.im/PeterCxy/OpenEUICC/pulls/290
Co-authored-by: septs <github@septs.pw>
Co-committed-by: septs <github@septs.pw>
septs 4 週間 前
コミット
0a353a3df6

+ 7 - 3
buildSrc/src/main/kotlin/im/angry/openeuicc/build/Versioning.kt

@@ -38,16 +38,20 @@ class MyVersioningPlugin : Plugin<Project> {
         target.configure<BaseAppModuleExtension> {
             defaultConfig {
                 versionCode = target.gitVersionCode
+                // format: <tag>[-<commits>-g<hash>][-dirty][-suffix]
                 versionName = target.getGitVersionName()
             }
 
             applicationVariants.all {
                 if (name == "debug") {
+                    val versionCode = (System.currentTimeMillis() / 1000).toInt()
+                    // format: <tag>-<commits>-g<hash>[-dirty][-suffix]
+                    val versionName = target.getGitVersionName("--long")
+                    val versionNameSuffix = mergedFlavor.versionNameSuffix
                     outputs.forEach {
                         with(it as ApkVariantOutputImpl) {
-                            versionCodeOverride = (System.currentTimeMillis() / 1000).toInt()
-                            // always keep the format: <tag>-<commits>-g<hash>[-dirty]
-                            versionNameOverride = target.getGitVersionName("--long")
+                            versionCodeOverride = versionCode
+                            versionNameOverride = versionName + versionNameSuffix
                         }
                     }
                 }