ELGIP-20 edits to allow use on windows

This commit is contained in:
Damian Smith 2018-11-30 17:55:55 +00:00
commit b8a0e604f1

View file

@ -10,43 +10,43 @@ def getGitRevision(String gitrootpath, int basebuildnumber) {
def String remoteinfo
def String remoteurl
dir( gitrootpath) {
if (isUnix()) {
def int changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim()
def int changecount
if (isUnix()) {
changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim()
}
else {
def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim()
def int changecount = stdout.readLines()[1] as int
}
else {
def stdout = bat(returnStdout:true , script: "git rev-list HEAD --count").trim()
changecount = stdout.readLines()[1] as int
}
echo "Change count: ${changecount}"
adjustedchangecount = (changecount + basebuildnumber) % (maxversionnumber() + 1)
echo "Adjusted change count: ${adjustedchangecount}"
if (isUnix()) {
if (isUnix()) {
gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
}
else {
def stdout = bat(returnStdout:true , script: "git rev-parse HEAD").trim()
gitrevision = stdout.readLines()[1] as int
}
}
else {
def stdout = bat(returnStdout:true , script: "git rev-parse HEAD").trim()
gitrevision = stdout.readLines()[1]
}
echo "Revision: ${gitrevision}"
if (isUnix()) {
if (isUnix()) {
remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim()
}
else {
def stdout = bat(returnStdout:true , script: "git remote show origin").trim()
remoteinfo = stdout.readLines()[1] as int
}
}
else {
def stdout = bat(returnStdout:true , script: "git remote show origin").trim()
remoteinfo = stdout.readLines()[1..-1]
}
echo "Remote info: ${remoteinfo}"
if (isUnix()) {
if (isUnix()) {
remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim()
}
else {
def stdout = bat(returnStdout:true , script: "git config --get remote.origin.ur").trim()
remoteurl = stdout.readLines()[1] as int
}
}
else {
def stdout = bat(returnStdout:true , script: "git config --get remote.origin.url").trim()
remoteurl = stdout.readLines()[1]
}
echo "Remote URL: ${remoteurl}"
}
return [adjustedchangecount, gitrevision, remoteinfo, remoteurl]