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
This commit is contained in:
Sai Krishna 2019-01-03 20:18:42 +05:30 committed by Vivek Maskara
parent bedc53b0ca
commit 7b2f7191f5

View file

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