Skip to content

Commit

Permalink
Catch git exec errors during build #3346
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Feb 4, 2018
1 parent 7db4511 commit 66b097b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ configurations {

// sets version to the slimeKnights version format
task buildInfo {
def cmd = "git rev-parse --short HEAD"
def proc = cmd.execute()
proc.waitFor()
if (proc.exitValue() == 0) {
ext.revision = proc.text.trim()
} else {
ext.revision = "GITBORK"
try {
def cmd = "git rev-parse --short HEAD"
def proc = cmd.execute()
proc.waitFor()
if (proc.exitValue() == 0) {
ext.revision = proc.text.trim()
} else {
ext.revision = "GITBORK"
}
} catch(all) {
ext.revision = "gitgud"
}

if (System.getenv().BUILD_NUMBER != null) {
Expand Down

0 comments on commit 66b097b

Please sign in to comment.