Added increment build metadata task.
This commit is contained in:
parent
edae9cc660
commit
a4e47cef0b
3 changed files with 119 additions and 1 deletions
50
README.md
50
README.md
|
@ -31,6 +31,8 @@ If you need to change the properties file or name of the properties keys to matc
|
|||
|
||||
## Increment Version Tasks
|
||||
|
||||
### incrementMajor, incrementMinor and incrementPatch
|
||||
|
||||
The `incrementMajor`, `incrementMinor` and `incrementPatch` tasks are available to automatically increment their respective and reset lower counterpart version numbers.
|
||||
|
||||
- `incrementMajor` will increment the `major` and set the `minor` and `patch` versions to `0`.
|
||||
|
@ -53,6 +55,52 @@ someTask {
|
|||
|
||||
- __Examples__: [Java](https://github.com/ethauvin/semver-gradle/tree/master/examples/java), [Kotlin](https://github.com/ethauvin/semver-gradle/tree/master/examples/kotlin)
|
||||
|
||||
### incrementBuildMeta
|
||||
|
||||
The `incrementBuildMeta` task is available to set the build metadata version to a custom calculated value.
|
||||
|
||||
#### Examples:
|
||||
|
||||
To set the build metadata to a custom formatted date:
|
||||
|
||||
```gradle
|
||||
incrementBuildMeta {
|
||||
doFirst {
|
||||
buildMeta = new Date().format("yyyyMMddHHmmss")
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
./gradlew incrementBuildMeta
|
||||
|
||||
...
|
||||
|
||||
> Task :incrementBuildMeta
|
||||
Version: 1.0.16-beta+20180713143416
|
||||
```
|
||||
|
||||
Or to set the build metadata to a custom formatted number with increment:
|
||||
|
||||
|
||||
```gradle
|
||||
incrementBuildMeta {
|
||||
doFirst {
|
||||
buildMeta = sprintf("%03d", (buildMeta as Integer) + 1)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
./gradlew incrementBuildMeta
|
||||
|
||||
...
|
||||
|
||||
> Task :incrementBuildMeta
|
||||
Version: 1.0.16-beta+002
|
||||
```
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
### Version File Properties
|
||||
|
@ -165,4 +213,4 @@ test.buildmeta=
|
|||
|
||||
If you'd like to incorporate the version number data into your source code, please have a look at the [__Semantic Version Annotation Processor__](https://github.com/ethauvin/semver).
|
||||
|
||||
There are also full [examples](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor) in both [Java](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/java) and [Kotlin](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor) showing how to use both the plugin and annotation processor concurrently.
|
||||
There are also full [examples](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor) in both [Java](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor/java) and [Kotlin](https://github.com/ethauvin/semver-gradle/tree/master/examples/annotation-processor) showing how to use both the plugin and annotation processor concurrently.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue