Skip to content

Doist/version-name-gradle-plugin

Repository files navigation

Version Name Gradle Plugin

This plugin adds a kotlin extension function that provides a version name based on the latest git tag.

How to use it πŸ‘£

Apply the plugin in build.gradle.kts:

plugins {
    id("com.doist.gradle.version-name")
}

Then, you can use:

versionName = project.versionName()

It adds also project.versionCode() extension method that's useful in Android projects. This can be used like:

android {
    defaultConfig {
        versionCode = project.versionCode()
        versionName = project.versionName()
        ...
    }
}

Version name is calculated based on the latest git tag. To be specific it uses following command to get it:

git describe --tags --abbrev=0 --match $prefix*

It requires git.

Version code is a version name without a prefix, v by default.

Configuration βš™οΈ

versionName {
    namePrefix.set("v")
}

Contributing 🀝

Feel free to open an issue or submit a pull request for any bugs/improvements.

Acknowledgements πŸ™

This plugin is based on kotlin-gradle-plugin-template 🐘

About

Gradle plugin to use git tags as project version names

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages