aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
diff options
context:
space:
mode:
authorYuutaW <17158086+Trumeet@users.noreply.github.com>2019-02-24 13:59:00 -0800
committerYuutaW <17158086+Trumeet@users.noreply.github.com>2019-02-24 13:59:00 -0800
commit105a6a118b3b8e73e5b1e8c264e80987654904d7 (patch)
tree9f0c46c4e9888a1049ca3c62991a169fa9073c3d /build.gradle
parent6ec68733e0f1c6a2bbbbb4735e9c1f2de8cf6b8c (diff)
downloadWorkMode-105a6a118b3b8e73e5b1e8c264e80987654904d7.tar
WorkMode-105a6a118b3b8e73e5b1e8c264e80987654904d7.tar.gz
WorkMode-105a6a118b3b8e73e5b1e8c264e80987654904d7.tar.bz2
WorkMode-105a6a118b3b8e73e5b1e8c264e80987654904d7.zip
feat(app): read version from VCS
Signed-off-by: YuutaW <17158086+Trumeet@users.noreply.github.com>
Diffstat (limited to 'build.gradle')
-rw-r--r--build.gradle16
1 files changed, 16 insertions, 0 deletions
diff --git a/build.gradle b/build.gradle
index 5ec9780..17b7709 100644
--- a/build.gradle
+++ b/build.gradle
@@ -28,3 +28,19 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}
+
+def gitCommitCount = 'git rev-list --count HEAD'.execute([], project.rootDir).text.trim()
+def version = "0.${gitCommitCount}"
+
+ext {
+ versionCode = Integer.parseInt("${gitCommitCount}")
+ versionName = "${version}"
+}
+
+task exportVersion(type: Exec) {
+ commandLine 'sh'
+ doLast {
+ file("$projectDir/version.txt").text = """$version"""
+ file("$projectDir/version_code.txt").text = """${gitCommitCount}"""
+ }
+} \ No newline at end of file