Add default build timestamp in case Git command fails.

This commit is contained in:
akwizgran
2018-06-06 14:18:38 +01:00
parent 8fc8333451
commit a24e0482c9

View File

@@ -245,8 +245,9 @@ android {
resValue "string", "app_name", "Briar"
buildConfigField "String", "GitHash",
"\"${getStdout(['git', 'rev-parse', '--short=7', 'HEAD'], 'No commit hash')}\""
def now = (long) (System.currentTimeMillis() / 1000)
buildConfigField "Long", "BuildTimestamp",
"${getStdout(['git', 'log', '-n', '1', '--format=%ct'], 0)}000L"
"${getStdout(['git', 'log', '-n', '1', '--format=%ct'], now)}000L"
}
buildTypes {