Speed up Gradle build times by enabling the Gradle Daemon
echo org.gradle.daemon=true >> ~/.gradle/gradle.properties
https://www.timroes.de/2013/09/12/speed-up-gradle/
Tie together the versionName and versionCode
https://plus.google.com/108284392618554783657/posts/6f5TcVPRZij
def versionMajor = 3
def versionMinor = 0
def versionPatch = 0
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
android {
defaultConfig {
versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
}
}
Add fields to BuildConfig from Gradle
https://plus.google.com/108284392618554783657/posts/6f5TcVPRZij
def gitSha() {
return 'git rev-parse --short HEAD'.execute().text.trim()
}
def buildTime() {
def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
df.setTimeZone(TimeZone.getTimeZone("UTC"))
return df.format(new Date())
}
android {
defaultConfig {
buildConfig """\
public static final String GIT_SHA = "${gitSha()}";
public static final String BUILD_TIME = "${buildTime()}";
"""
}
}
https://www.timroes.de/2013/09/22/handling-signing-configs-with-gradle/