Skip to content

Instantly share code, notes, and snippets.

@passsy
Last active September 22, 2017 14:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save passsy/af4fcf46ef58dd0ed33e46b2a4e69d0b to your computer and use it in GitHub Desktop.
Save passsy/af4fcf46ef58dd0ed33e46b2a4e69d0b to your computer and use it in GitHub Desktop.
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