浏览代码

android: generate versionCode automatically

It's a number whichb must be ever increasing with each build submitted to the
store.

Automate its value by using the number of seconds since 1st of January 2019.
That should be enough for ~680 years.
master
Saúl Ibarra Corretgé 6 年前
父节点
当前提交
030af37668
共有 2 个文件被更改,包括 6 次插入2 次删除
  1. 6
    1
      android/app/build.gradle
  2. 0
    1
      android/gradle.properties

+ 6
- 1
android/app/build.gradle 查看文件

8
     apply plugin: 'io.fabric'
8
     apply plugin: 'io.fabric'
9
 }
9
 }
10
 
10
 
11
+// Use the number of seconds/10 since Jan 1 2019 as the versionCode.
12
+// This lets us upload a new build at most every 10 seconds for the
13
+// next ~680 years.
14
+// https://stackoverflow.com/a/38643838
15
+def vcode = (int)(((new Date().getTime()/1000) - 1546297200) / 10)
11
 
16
 
12
 android {
17
 android {
13
     compileSdkVersion rootProject.ext.compileSdkVersion
18
     compileSdkVersion rootProject.ext.compileSdkVersion
15
 
20
 
16
     defaultConfig {
21
     defaultConfig {
17
         applicationId 'org.jitsi.meet'
22
         applicationId 'org.jitsi.meet'
18
-        versionCode Integer.parseInt(project.buildNumber)
23
+        versionCode vcode
19
         versionName project.appVersion
24
         versionName project.appVersion
20
 
25
 
21
         minSdkVersion rootProject.ext.minSdkVersion
26
         minSdkVersion rootProject.ext.minSdkVersion

+ 0
- 1
android/gradle.properties 查看文件

17
 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17
 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
 # org.gradle.parallel=true
18
 # org.gradle.parallel=true
19
 
19
 
20
-buildNumber=1
21
 appVersion=19.1.0
20
 appVersion=19.1.0
22
 sdkVersion=2.0.0
21
 sdkVersion=2.0.0

正在加载...
取消
保存