apps-android-commons/gitutils.gradle
Sai Krishna 7b2f7191f5 Fix for issue #1157 Added try-catch block in getBuildVersion function in gitutils.gradle … (#1158)
* Added try-catch block in getBuildVersion function in gitutils.gradle file.

* Formatting fix

* Add comment
2019-01-03 20:18:42 +05:30

26 lines
690 B
Groovy

ext.getBuildVersion = { ->
// Short-term fix for #1157. Should ideally look into why method is failing.
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git' , 'rev-parse' , '--short' , 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (ignored) {
return null
}
}
ext.getBranchName = { ->
try {
def stdOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = stdOut
}
return stdOut.toString().trim()
} catch (ignored) {
return null
}
}