From 42be3edf77688c562dccc3587fdc1834efee57c5 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Mon, 12 Feb 2018 12:38:38 +0100 Subject: [PATCH 1/3] add nicer variable based versioning calculation --- build.gradle | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 11fe69547b..43804204cd 100644 --- a/build.gradle +++ b/build.gradle @@ -50,6 +50,13 @@ repositories { } } +// semantic versioning for version code +def versionMajor = 3 +def versionMinor = 1 +def versionPatch = 0 +def versionBuild = 1 // alphas, betas, release candidates (<99=non-stable, 99=stable) +def versionNameSuffix = " Alpha" // empty for stable releases + android { lintOptions { abortOnError false @@ -78,8 +85,8 @@ android { multiDexEnabled true - versionCode = 30010000 - versionName = "3.1.0 Alpha" + versionCode versionMajor * 10000000 + versionMinor * 100000 + versionPatch * 100 + versionBuild + versionName "${versionMajor}.${versionMinor}.${versionPatch}${versionNameSuffix}" // adapt structure from Eclipse to Gradle/Android Studio expectations; // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure From 0d382d0214326bc95290099afc72e06833464909 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Mon, 12 Feb 2018 16:10:41 +0100 Subject: [PATCH 2/3] secure withspace for non-stable release names --- build.gradle | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 43804204cd..da0694bc74 100644 --- a/build.gradle +++ b/build.gradle @@ -55,7 +55,7 @@ def versionMajor = 3 def versionMinor = 1 def versionPatch = 0 def versionBuild = 1 // alphas, betas, release candidates (<99=non-stable, 99=stable) -def versionNameSuffix = " Alpha" // empty for stable releases +def versionNameSuffix = "Alpha" // ignored for stable releases android { lintOptions { @@ -86,7 +86,12 @@ android { multiDexEnabled true versionCode versionMajor * 10000000 + versionMinor * 100000 + versionPatch * 100 + versionBuild - versionName "${versionMajor}.${versionMinor}.${versionPatch}${versionNameSuffix}" + + if (versionBuild > 98) { + versionName "${versionMajor}.${versionMinor}.${versionPatch}" + } else { + versionName "${versionMajor}.${versionMinor}.${versionPatch} ${versionNameSuffix}" + } // adapt structure from Eclipse to Gradle/Android Studio expectations; // see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure From 4679161d649322e2b4f0e00c840855cff870a521 Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Thu, 15 Feb 2018 12:30:26 +0100 Subject: [PATCH 3/3] auto generate app name --- build.gradle | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index da0694bc74..5cfb3f60c2 100644 --- a/build.gradle +++ b/build.gradle @@ -54,8 +54,7 @@ repositories { def versionMajor = 3 def versionMinor = 1 def versionPatch = 0 -def versionBuild = 1 // alphas, betas, release candidates (<99=non-stable, 99=stable) -def versionNameSuffix = "Alpha" // ignored for stable releases +def versionBuild = 0 // 0-49=Alpha / 50-98=RC / 99=stable android { lintOptions { @@ -89,8 +88,10 @@ android { if (versionBuild > 98) { versionName "${versionMajor}.${versionMinor}.${versionPatch}" + } else if (versionBuild > 49) { + versionName "${versionMajor}.${versionMinor}.${versionPatch} RC"+(versionBuild-49) } else { - versionName "${versionMajor}.${versionMinor}.${versionPatch} ${versionNameSuffix}" + versionName "${versionMajor}.${versionMinor}.${versionPatch} Alpha"+(versionBuild+1) } // adapt structure from Eclipse to Gradle/Android Studio expectations;