From f826bfe474cbbfd272aa8d5ea29ae585cac0f68d Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 30 Jan 2019 12:35:12 +0100 Subject: [PATCH] Use git describe to generate apk names --- app/build.gradle | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 18d4ef4fd..c90cb1dcb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -30,6 +30,22 @@ excludePackage.add('**/libopenh264**') excludePackage.add('**/**tester**') excludePackage.add('**/LICENSE.txt') + +def gitVersion = new ByteArrayOutputStream() + +task getGitVersion { + exec { + commandLine 'git', 'describe', '--always' + standardOutput = gitVersion + } + doLast { + gitVersion = gitVersion.toString().trim() + println("Git version: " + gitVersion) + } +} + +project.tasks['preBuild'].dependsOn 'getGitVersion' + ///////////////////////// repositories { @@ -57,7 +73,7 @@ android { applicationVariants.all { variant -> variant.outputs.all { - outputFileName = "linphone-android-${variant.buildType.name}-${defaultConfig.versionName}.apk" + outputFileName = "linphone-android-${variant.buildType.name}-${gitVersion.toString().trim()}.apk" } }