Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
include git-versioner into your project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
// Optional: configure the versioner
/*ext.gitVersioner = [
defaultBranch : "develop", // default "master"
yearFactor : 1200, // default "1000", increasing every 8.57h
snapshotEnabled : false, // default false, the "-SNAPSHOT" postfix
localChangesCountEnabled: false // default false, the (<commitCount>) before -SNAPSHOT
]*/
// import the script which runs the version generation
apply from: 'https://raw.githubusercontent.com/passsy/gradle-GitVersioner/master/git-versioner.gradle'
android {
defaultConfig {
...
buildConfigField 'String', 'REVISION', "\"$gitVersionName\""
}
productFlavors {
...
beta {
applicationIdSuffix '.beta'
versionCode gitVersion.version
versionName gitVersionName
}
playStore {
versionCode 21
versionName '3.0.1'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment