simplified the version generation during build time and got rid of the deprecated exec{}
This commit is contained in:
parent
8ea702c2e2
commit
b16af4b1e9
1 changed files with 4 additions and 18 deletions
|
|
@ -1,26 +1,12 @@
|
||||||
def execThing (String cmdStr) {
|
static def execThing (String cmd) {
|
||||||
def stdout = new ByteArrayOutputStream()
|
return cmd.execute().text.trim()
|
||||||
String prefix = System.getenv("GITCMDPREFIX")
|
|
||||||
if (prefix != null) {
|
|
||||||
String cmd = prefix + cmdStr
|
|
||||||
exec {
|
|
||||||
commandLine cmd.tokenize()
|
|
||||||
standardOutput = stdout
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
exec {
|
|
||||||
commandLine cmdStr.tokenize()
|
|
||||||
standardOutput = stdout
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return stdout.toString().trim()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def getCurrentGitHash() {
|
static def getCurrentGitHash() {
|
||||||
return execThing('git rev-parse --short=8 HEAD')
|
return execThing('git rev-parse --short=8 HEAD')
|
||||||
}
|
}
|
||||||
|
|
||||||
def generateVersionName() {
|
static def generateVersionName() {
|
||||||
// major version
|
// major version
|
||||||
String versionTagsRaw = execThing('git tag --list v[0-9]*')
|
String versionTagsRaw = execThing('git tag --list v[0-9]*')
|
||||||
int versionTagsCount = versionTagsRaw == "" ? 0 : versionTagsRaw.split('\n').size()
|
int versionTagsCount = versionTagsRaw == "" ? 0 : versionTagsRaw.split('\n').size()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue