[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] set versionName from git release tags
commit 04bdf167d14c12034ff8103ead3d817aa0c9637e
Author: Hans-Christoph Steiner <hans@xxxxxxx>
Date: Wed Nov 22 15:29:07 2017 +0100
set versionName from git release tags
This makes git release tags the one canonical place to set the version name
---
app/build.gradle | 14 +++++++++++++-
make-release-build | 6 +++---
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index 3c6e1b6c..d7d8957c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,5 +1,6 @@
apply plugin: 'com.android.application'
+
// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")
@@ -12,6 +13,16 @@ if (keystorePropertiesFile.canRead()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
+/* gets the version name from the latest Git tag, stripping the leading v off */
+def getVersionName = { ->
+ def stdout = new ByteArrayOutputStream()
+ exec {
+ commandLine 'git', 'describe', '--tags', '--always'
+ standardOutput = stdout
+ }
+ return stdout.toString().trim()
+}
+
android {
signingConfigs {
release {
@@ -28,6 +39,7 @@ android {
buildToolsVersion '29.0.0'
defaultConfig {
applicationId "org.torproject.android"
+ versionName getVersionName()
minSdkVersion 16
targetSdkVersion 29
}
@@ -62,7 +74,7 @@ android {
applicationId 'org.torproject.android'
targetSdkVersion 28
versionCode 16123000
- versionName '16.1.2-RC-2-tor-0.4.1.5-rc'
+ versionName getVersionName()
archivesBaseName = "Orbot-$versionName"
}
}
diff --git a/make-release-build b/make-release-build
index d15e6f0c..fb712011 100755
--- a/make-release-build
+++ b/make-release-build
@@ -6,9 +6,9 @@ set -e
set -x
# make sure we're on a signed tag that matches the version name
-versionName=`sed -n 's,.*versionName="\([^"]*\)".*,\1,p' app/src/main/AndroidManifest.xml`
-describe=`git describe`
-if [ $versionName != $describe ]; then
+describe=`git describe --tags --always`
+versionName=`echo $describe | sed 's,-[0-9][0-9]*-g.*,,'`
+if [ "$versionName" != "$describe" ]; then
echo "WARNING: building $describe, which is not the latest release ($versionName)"
else
# make a clearer warning above by putting this here
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits