Skip to content

Instantly share code, notes, and snippets.

@zsoltk
Last active January 18, 2016 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsoltk/3068257623f1e608ac02 to your computer and use it in GitHub Desktop.
Save zsoltk/3068257623f1e608ac02 to your computer and use it in GitHub Desktop.
// This will break incremental compilation
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def buildTime = new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC"))
android {
defaultConfig {
buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
buildConfigField "String", "BUILD_TIME", "\"${buildTime}\""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment