forked from commons-app/apps-android-commons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitutils.gradle
More file actions
26 lines (25 loc) · 690 Bytes
/
gitutils.gradle
File metadata and controls
26 lines (25 loc) · 690 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
}
}