Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Latest commit

 

History

History
100 lines (74 loc) · 3.11 KB

README.md

File metadata and controls

100 lines (74 loc) · 3.11 KB

Caution

This project is officially unmaintained and known incompatible with Gradle 9 and its Configuration Cache.

License: GPL v3 Maven Central Gradle Plugin Portal Build Status Coverage

gradle-versioning-plugin

A Gradle plugin to unify the versioning workflow of Gradle builds.

Features

  • Automatic sync Gradle builds's version property.
  • Automatic update of versionName and versionCode of an Android project

Usage

For automatic version handling on any Gradle build add:

plugins {
    id("com.glovoapp.semantic-versioning") version < latest >
}

Once applied, the Project.version will be set with the given version which can it also be accessed from semanticVersion.version property:

task("printVersion") {
    doLast {
        pritnln("The project current version is ${project.semanticVersion.version.get()}")
    }
}

The plugin requires a version.properties file at root project containing the current version entry:

version=1.2.3

A incrementSemanticVersion task will be added to the build. When triggered (from CI for instance) it will increase the version and update the file.

./gradlew incrementSemanticVersion

Will result on

version=1.2.4

You may specify also which version to increase: --major, --minor or --path

./gradlew incrementSemanticVersion --major

Will result on

version=2.0.0

Android Version Name plugin

An Android extension is also available by applying:

plugins {
    id("com.glovoapp.android-versioning") version < latest >
}

Once applied, version can access from the android.versioning.version property:

task("printVersion") {
    doLast {
        val androidVersion = project.android.versioning.version.get()
        pritnln("The project current versionCode is ${androidVersion.code} and name is ${androidVersion.name}")
    }
}

The plugin requires a version.properties file at root project containing the at least one of the following entries:

versionCode=10
versionName=1.2.3

If versionCode is set, and incrementVersionCode task will be added to the project. The behavior is the same, when run, the task will increment the versionCode by 1 (or by --amount=XXX)

If versionName is set, and incrementVersionName task will be added to the project. The behavior is exactly the same as the incrementSemanticVersion task for non-Android projects.