Gitflow versioning plugin for gradle
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
buildSrc
config/checkstyle
gradle
src
.gitignore
.travis.yml
CHANGE.md
README.md
build.gradle
gradlew
gradlew.bat
settings.gradle

README.md

gradle-gitflow-plugin

Build Status Download

This project is a GitFlow versioning plugin for gradle.

This plugin will infer the version number to use for your project based on the state of the git repository.

Usage

Apply the plugin and add it as a classpath dependency as demonstrated below:

Example build.gradle:

apply plugin: 'uk.co.jamesridgway.gradle.gitflow.plugin'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'uk.co.jamesridgway:gradle-gitflow-plugin:1.5.5'
    }
}

That's all it takes, the plugin will set the version attribute of your build automatically.

How does it work?

The plugin uses jgit to infer the version number from the state of the repository.

The version can be inferred without needing to add or alter any tasks in the gradle task graph.

Release Version

A tagged commit of the format major.minor.patch (on any branch) will be determined as a release version.

Unreleased Version

For any commit that is not tagged with a release version (major.minor.patch) an "unreleased" version will be inferred.

By default, an unreleased version is as follows:

0.0.1.1-feature/test1+sha.8661cfd.dirty
| | | | |                 |       |
| | | | |                 |       └ "dirty" is ppended if the commit is dirty
| | | | |                 └ Short commit id
| | | | └ Branch name
| | | └ Number of commits since last tag
| | └ Patch version for last release version
| └ Minor version for last release version
└ Major version for last release version

If the repository has never been tagged for a release the version will default to 0.0.0

Configuration

The following can be configured:

  • Unreleased version template

Refer to the configuration section of the wiki for detailed instructions on how to configure the plugin.