Skip to content

Commit

Permalink
handle error when git is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Jan 4, 2025
1 parent 56524a5 commit fe6e908
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions android-refimpl-app/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@ plugins {
// apply plugin: 'kotlin-android-extensions'

def getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--verify', '--short=8', 'HEAD'
standardOutput = stdout
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--verify', '--short=8', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
catch (Exception ignored)
{
return "????????"
}
return stdout.toString().trim()
}

android {
Expand Down

0 comments on commit fe6e908

Please sign in to comment.