Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
Fixes reading git tag for release.
Browse files Browse the repository at this point in the history
  • Loading branch information
MRezaNasirloo committed Mar 28, 2018
1 parent 0deed02 commit 5856f9b
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions buildscript/version.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,11 @@
* Gets the version name from the latest Git tag
*/
ext.gitVersionName = { ->
def branchOut = new ByteArrayOutputStream()
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = branchOut
}
def branch = branchOut.toString().trim()

if (branch == "master") {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
if (stdout.toString().trim().isEmpty()) return "Unversioned"
return stdout.toString().trim().replace('v', '')
} else {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return "$branch-" + stdout.toString().trim()
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
if (stdout.toString().trim().isEmpty()) return "Unversioned"
return stdout.toString().trim().replace('v', '')
}

0 comments on commit 5856f9b

Please sign in to comment.