https://github.com/doist/version-name-gradle-plugin
Gradle plugin to use git tags as project version names
https://github.com/doist/version-name-gradle-plugin
Last synced: 3 months ago
JSON representation
Gradle plugin to use git tags as project version names
- Host: GitHub
- URL: https://github.com/doist/version-name-gradle-plugin
- Owner: Doist
- License: mit
- Created: 2021-10-04T15:14:11.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T11:38:09.000Z (almost 3 years ago)
- Last Synced: 2025-03-06T13:39:14.786Z (over 1 year ago)
- Language: Kotlin
- Size: 72.3 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 🐘](https://github.com/cortinico/kotlin-gradle-plugin-template)