Преглед изворни кода

Fix sporadic failure in non-git build (using patch by @nikclayton) (#3307)

mcclure пре 1 година
родитељ
комит
4dc7919ec0
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      app/build.gradle

+ 3 - 2
app/build.gradle

@@ -7,12 +7,13 @@ plugins {
 
 // For constructing gitSha only
 def getGitSha = {
-    try {
+    try {  // Try-catch is necessary for build to work on non-git distributions
         providers.exec {
             commandLine 'git', 'rev-parse', 'HEAD'
+            executionResult.rethrowFailure() // Without this, sometimes it just stops immediately instead of throwing
         }.standardOutput.asText.get().trim()
     } catch (Exception e) {
-        "unknown" // Try-catch is necessary for build to work on non-git distributions
+        "unknown"
     }
 }