diff options
author | ByteHamster <info@bytehamster.com> | 2021-04-17 17:17:11 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-04-17 17:17:11 +0200 |
commit | e6aa8831f18de734a6a4c3911219c4415bf0b2a7 (patch) | |
tree | c46de877ea81af28fef887d83cb5aadac9f59dc8 | |
parent | 068e163dd70a0529f7eb9c2787e0badac2abcada (diff) | |
download | AntennaPod-e6aa8831f18de734a6a4c3911219c4415bf0b2a7.zip |
Fixed getting git hash in new Android Studio
-rw-r--r-- | app/build.gradle | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/build.gradle b/app/build.gradle index a2feb40b8..a64005a92 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,12 +31,17 @@ android { testApplicationId "de.test.antennapod" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - def commit = "Unknown commit" + def commit = "" try { - commit = "git rev-parse --short HEAD".execute().text.trim() + def hashStdOut = new ByteArrayOutputStream() + exec { + commandLine "git", "rev-parse", "--short", "HEAD" + standardOutput = hashStdOut + } + commit = hashStdOut.toString().trim() } catch (Exception ignore) { } - buildConfigField "String", "COMMIT_HASH", ('"' + commit + '"') + buildConfigField "String", "COMMIT_HASH", ('"' + (commit.isEmpty() ? "Unknown commit" : commit) + '"') if (project.hasProperty("podcastindexApiKey")) { buildConfigField "String", "PODCASTINDEX_API_KEY", '"' + podcastindexApiKey + '"' |