mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-18 23:14:22 +01:00
28 lines
622 B
Groovy
28 lines
622 B
Groovy
ext.getVersionCodeFromTags = { ->
|
|
try {
|
|
def code = new ByteArrayOutputStream()
|
|
exec {
|
|
commandLine 'git', 'log'
|
|
standardOutput = code
|
|
}
|
|
return code.toString().split("\n").size()
|
|
}
|
|
catch (ignored) {
|
|
return -1
|
|
}
|
|
}
|
|
|
|
ext.getVersionNameFromTags = { ->
|
|
try {
|
|
def stdout = new ByteArrayOutputStream()
|
|
exec {
|
|
commandLine 'git', 'describe', '--tags', '--abbrev=0'
|
|
standardOutput = stdout
|
|
}
|
|
return stdout.toString().trim().split("%")[0]
|
|
}
|
|
catch (ignored) {
|
|
return null
|
|
}
|
|
}
|