IMPORTANT: This plugin is deprecated
Please migrate to: https://github.com/bulwinkel/gradle-git-version
Plugin which exposes the commit count and latest tag to your gradle build for use as the build number and version code respectively.
Apply the plugin in your build.gradle
file:
buildscript {
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.github.bulwinkel:gradle-git-info:1.1.0'
}
}
apply plugin: 'com.bulwinkel.gradle-git-info'
The git info is then exposed via the gitInfo
extension property on your project instance:
println "commitCount: ${project.gitInfo.commitCount}"
println "latestTag: ${project.gitInfo.latestTag}"
There is nothing original here, rather just the packaging of other peoples ideas into an easy to apply plugin.
- Automatic Versioning With Git and Gradle
- Smart versionName and versionCode for android Gradle build evaluation
Copyright 2016 Kelvin Bulwinkel
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.