Use same versioning system in Android APK.

This commit is contained in:
Jean-Philip Desjardins 2020-08-10 13:38:29 -04:00
parent 5c3b37abb9
commit 2b8b6dfad8
2 changed files with 7 additions and 3 deletions

View file

@ -277,7 +277,7 @@ public class MainActivity extends AppCompatActivity implements NavigationDrawerF
String buildDateString = new SimpleDateFormat("yyyy/MM/dd K:mm a", Locale.getDefault()).format(buildDate); String buildDateString = new SimpleDateFormat("yyyy/MM/dd K:mm a", Locale.getDefault()).format(buildDate);
String timestamp = buildDateString.substring(11, buildDateString.length()).startsWith("0:") String timestamp = buildDateString.substring(11, buildDateString.length()).startsWith("0:")
? buildDateString.replace("0:", "12:") : buildDateString; ? buildDateString.replace("0:", "12:") : buildDateString;
String aboutMessage = String.format("Build Date: %s", timestamp); String aboutMessage = String.format("Version: %s Date: %s", BuildConfig.VERSION_NAME, timestamp);
displaySimpleMessage("About Play!", aboutMessage); displaySimpleMessage("About Play!", aboutMessage);
} }

View file

@ -10,12 +10,16 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.0.1' classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'org.ajoberstar.grgit:grgit-gradle:4.0.2'
} }
} }
project.ext { project.ext {
keyStorePropFile = rootProject.file('keystore.properties') keyStorePropFile = rootProject.file('keystore.properties')
signingEnabled = keyStorePropFile.exists() signingEnabled = keyStorePropFile.exists()
git = org.ajoberstar.grgit.Grgit.open()
gitVersionCode = git.tag.list().size()
gitVersionName = "${git.describe()}"
} }
project.afterEvaluate { project.afterEvaluate {
@ -42,8 +46,8 @@ android {
compileSdkVersion 'android-28' compileSdkVersion 'android-28'
defaultConfig { defaultConfig {
versionCode 40 versionCode (100 + gitVersionCode)
versionName '0.30' versionName gitVersionName
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 28 targetSdkVersion 28
externalNativeBuild { externalNativeBuild {