From 38b5e7dc658a7ae791c2fef35cf83c06e65fe4e7 Mon Sep 17 00:00:00 2001 From: Amine Bou Date: Thu, 24 May 2018 22:32:34 +0200 Subject: [PATCH] New (new, new, new, new) way for handling versions. Will work with jenkins and fdroid. --- app/build.gradle | 14 +++++--------- version.sh | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) create mode 100755 version.sh diff --git a/app/build.gradle b/app/build.gradle index a90cba4..20bbc30 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,17 +15,13 @@ def gitVersion() { } def versionCodeFromGit() { - def dayInYear = ext.configuration.buildDate.format("D").padLeft(3, '0') - def versionCode = gitVersion() + (ext.configuration.buildDate.format("yyMM") + dayInYear + ext.todaysBuilds).toInteger() - println "version code " + versionCode - return versionCode.toInteger() + println "version code " + gitVersion() + return gitVersion().toInteger() } def versionNameFromGit() { - def dayInYear = ext.configuration.buildDate.format("D").padLeft(3, '0') - def versionName = gitVersion() + ext.configuration.buildDate.format('yyMM') + dayInYear + ext.todaysBuilds - println "version name " + versionName - return versionName + println "version name " + gitVersion() + return gitVersion() } apply plugin: 'com.android.application' @@ -176,4 +172,4 @@ def initAppLoginPropertiesIfNeeded() { entry(key: "appLoginPassword", value: System.getProperty("appLoginPassword")) } } -} +} \ No newline at end of file diff --git a/version.sh b/version.sh new file mode 100755 index 0000000..843bf20 --- /dev/null +++ b/version.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +BASE_VERSION="v1.6" +TODAYS_VERSION="1" + +VERSION="${BASE_VERSION}.$(date '+%y%m%j')$TODAYS_VERSION" + +echo "Creating tag $VERSION" + +git tag $VERSION + +echo "Pushing tag" + +git push origin $VERSION