diff --git a/app/build.gradle b/app/build.gradle index 4aa1579e..67f81e0d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,11 +20,20 @@ repositories { } static def gitBranch() { - def branch = '' - def proc = 'git rev-parse --abbrev-ref HEAD'.execute() - proc.in.eachLine { line -> branch = line } - proc.err.eachLine { line -> println line } - proc.waitFor() + def branch = 'GitHub' + try { + def gitcheck = 'command -v git >/dev/null 2>&1'.execute() + gitcheck.waitFor() + if (gitcheck.exitValue() == 0) { + def proc = 'git rev-parse --abbrev-ref HEAD'.execute() + proc.in.eachLine { line -> branch = line } + proc.err.eachLine { line -> println line } + proc.waitFor() + } + } catch (Exception e) { + // Do nothing + println e + } branch }