diff options
author | YuutaW <17158086+Trumeet@users.noreply.github.com> | 2019-02-24 13:59:00 -0800 |
---|---|---|
committer | YuutaW <17158086+Trumeet@users.noreply.github.com> | 2019-02-24 13:59:00 -0800 |
commit | 105a6a118b3b8e73e5b1e8c264e80987654904d7 (patch) | |
tree | 9f0c46c4e9888a1049ca3c62991a169fa9073c3d /build.gradle | |
parent | 6ec68733e0f1c6a2bbbbb4735e9c1f2de8cf6b8c (diff) | |
download | WorkMode-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.gradle | 16 |
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 |