Skip to content
Snippets Groups Projects
Verified Commit 597e2a23 authored by akwizgran's avatar akwizgran
Browse files

Use git commit timestamp as build timestamp.

parent e83d8bb7
No related branches found
No related tags found
No related merge requests found
......@@ -218,16 +218,16 @@ dependencyVerification {
]
}
def getGitHash = { ->
def getStdout = { command, defaultValue ->
def stdout = new ByteArrayOutputStream()
try {
exec {
commandLine 'git', 'rev-parse', '--short=7', 'HEAD'
commandLine = command
standardOutput = stdout
}
return stdout.toString().trim()
} catch (Exception ignored) {
return "No commit hash"
return defaultValue
}
}
......@@ -243,8 +243,10 @@ android {
applicationId "org.briarproject.briar.android"
resValue "string", "app_package", "org.briarproject.briar.android"
resValue "string", "app_name", "Briar"
buildConfigField "String", "GitHash", "\"${getGitHash()}\""
buildConfigField "Long", "BuildTimestamp", "${System.currentTimeMillis()}L"
buildConfigField "String", "GitHash",
"\"${getStdout(['git', 'rev-parse', '--short=7', 'HEAD'], 'No commit hash')}\""
buildConfigField "Long", "BuildTimestamp",
"${getStdout(['git', 'log', '-n', '1', '--date=unix', '--format=%cd'], 0)}000L"
}
buildTypes {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment