Who knows if this works
This commit is contained in:
23
build.gradle
23
build.gradle
@@ -24,17 +24,22 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
def gitCommitHash = { ->
|
def gitCommitHash = { ->
|
||||||
def stdout = new ByteArrayOutputStream()
|
try {
|
||||||
ExecResult result = exec ()->{
|
def stdout = new ByteArrayOutputStream()
|
||||||
commandLine 'git', 'rev-parse', '--short', 'HEAD'
|
ExecResult result = exec () -> {
|
||||||
standardOutput = stdout
|
commandLine 'git', 'rev-parse', '--short', 'HEAD'
|
||||||
ignoreExitValue = true
|
standardOutput = stdout
|
||||||
}
|
ignoreExitValue = true
|
||||||
|
}
|
||||||
|
|
||||||
if (result.getExitValue() != 0) {
|
if (result.getExitValue() != 0) {
|
||||||
|
return "<UnknownCommit>";
|
||||||
|
} else {
|
||||||
|
return stdout.toString().trim();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace()
|
||||||
return "<UnknownCommit>";
|
return "<UnknownCommit>";
|
||||||
} else {
|
|
||||||
return stdout.toString().trim();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user