Files
coco 723ce1af5c a
2026-07-03 15:12:48 +08:00

28 lines
636 B
Groovy

ext.getVersionCodeFromTags = { ->
try {
def code = new ByteArrayOutputStream()
exec {
commandLine 'git', 'tag', '--list'
standardOutput = code
}
return 2 + 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
}
}