Addded the ability to specify the semver property key.
This commit is contained in:
parent
1b12eba58b
commit
963966eb1c
4 changed files with 23 additions and 4 deletions
18
README.md
18
README.md
|
@ -21,6 +21,7 @@ version.minor=0
|
||||||
version.patch=0
|
version.patch=0
|
||||||
version.prerelease=
|
version.prerelease=
|
||||||
version.buildmeta=
|
version.buildmeta=
|
||||||
|
version.semver=1.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
To change the version of your project, remove the version from your `build.gradle` and simply edit your the version properties file to match your version number.
|
To change the version of your project, remove the version from your `build.gradle` and simply edit your the version properties file to match your version number.
|
||||||
|
@ -107,7 +108,17 @@ Version: 1.0.16-beta+002
|
||||||
The `major`, `minor`, `patch`, `prerelease` and `buildmeta` versions can also be set via the command line:
|
The `major`, `minor`, `patch`, `prerelease` and `buildmeta` versions can also be set via the command line:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./gradlew -Dversion.prerelease=beta ...
|
./gradlew -Dversion.prerelease=beta -Dversion.buildmeta= ...
|
||||||
|
```
|
||||||
|
|
||||||
|
```ini
|
||||||
|
#version.properties
|
||||||
|
version.major=1
|
||||||
|
version.minor=0
|
||||||
|
version.patch=0
|
||||||
|
version.prerelease=
|
||||||
|
version.buildmeta=beta
|
||||||
|
version.semver=1.0.0-beta
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
@ -132,6 +143,8 @@ The version number is built as follows:
|
||||||
|
|
||||||
`version.major` `version.separtor` `version.minor` `version.separator` `version.patch` `[` `version.prerelease.prefix` `version.prerelease` `]` `[` `version.prerelease.prefix` `version.buildmeta` `]`
|
`version.major` `version.separtor` `version.minor` `version.separator` `version.patch` `[` `version.prerelease.prefix` `version.prerelease` `]` `[` `version.prerelease.prefix` `version.buildmeta` `]`
|
||||||
|
|
||||||
|
For reference, it is automatically included in the `version.semver` property.
|
||||||
|
|
||||||
for example:
|
for example:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
|
@ -141,6 +154,7 @@ version.minor=0
|
||||||
version.patch=0
|
version.patch=0
|
||||||
version.prerelease=beta
|
version.prerelease=beta
|
||||||
version.buildmeta=exp.sha.5114f85
|
version.buildmeta=exp.sha.5114f85
|
||||||
|
version.sevmer=1.0.0-beta+exp.sha.5114f85
|
||||||
```
|
```
|
||||||
|
|
||||||
`project.version` will be `1.0.0-beta+exp.sha.5114f85` in Gradle.
|
`project.version` will be `1.0.0-beta+exp.sha.5114f85` in Gradle.
|
||||||
|
@ -181,6 +195,7 @@ min=0
|
||||||
build=0
|
build=0
|
||||||
rel=beta
|
rel=beta
|
||||||
meta=
|
meta=
|
||||||
|
semver=1.0.0-beta
|
||||||
```
|
```
|
||||||
|
|
||||||
The following `semver` properties are available:
|
The following `semver` properties are available:
|
||||||
|
@ -214,6 +229,7 @@ test.minor=0
|
||||||
test.patch=0
|
test.patch=0
|
||||||
test.prerelease=
|
test.prerelease=
|
||||||
test.buildmeta=
|
test.buildmeta=
|
||||||
|
test.semver=1.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
- __Examples__: [Java](https://github.com/ethauvin/semver-gradle/tree/master/examples/java), [Kotlin](https://github.com/ethauvin/semver-gradle/tree/master/examples/kotlin)
|
- __Examples__: [Java](https://github.com/ethauvin/semver-gradle/tree/master/examples/java), [Kotlin](https://github.com/ethauvin/semver-gradle/tree/master/examples/kotlin)
|
||||||
|
|
|
@ -70,6 +70,7 @@ open class SemverConfig {
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "SemverConfig(" +
|
return "SemverConfig(" +
|
||||||
"properties='$properties', " +
|
"properties='$properties', " +
|
||||||
|
"semver='$semverKey', " +
|
||||||
"majorKey='$majorKey', " +
|
"majorKey='$majorKey', " +
|
||||||
"minorKey='$minorKey', " +
|
"minorKey='$minorKey', " +
|
||||||
"patchKey='$patchKey', " +
|
"patchKey='$patchKey', " +
|
||||||
|
@ -79,6 +80,6 @@ open class SemverConfig {
|
||||||
"buildMetaPrefixKey='$buildMetaPrefixKey', " +
|
"buildMetaPrefixKey='$buildMetaPrefixKey', " +
|
||||||
"separator='$separatorKey', " +
|
"separator='$separatorKey', " +
|
||||||
"keysPrefix='$keysPrefix')" +
|
"keysPrefix='$keysPrefix')" +
|
||||||
")"
|
')'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,8 @@ object Utils {
|
||||||
put(config.patchKey, version.patch)
|
put(config.patchKey, version.patch)
|
||||||
put(config.preReleaseKey, version.preRelease)
|
put(config.preReleaseKey, version.preRelease)
|
||||||
put(config.buildMetaKey, version.buildMeta)
|
put(config.buildMetaKey, version.buildMeta)
|
||||||
|
put(config.semverKey, version.semver)
|
||||||
|
|
||||||
put(config.buildMetaPrefixKey, version.buildMetaPrefix,
|
put(config.buildMetaPrefixKey, version.buildMetaPrefix,
|
||||||
version.buildMetaPrefix != Version.DEFAULT_BUILDMETA_PREFIX ||
|
version.buildMetaPrefix != Version.DEFAULT_BUILDMETA_PREFIX ||
|
||||||
containsKey(config.buildMetaPrefixKey))
|
containsKey(config.buildMetaPrefixKey))
|
||||||
|
|
|
@ -78,7 +78,7 @@ class Version {
|
||||||
"preReleasePrefix='$preReleasePrefix', " +
|
"preReleasePrefix='$preReleasePrefix', " +
|
||||||
"buildMeta='$buildMeta', " +
|
"buildMeta='$buildMeta', " +
|
||||||
"buildMetaPrefix='$buildMetaPrefix', " +
|
"buildMetaPrefix='$buildMetaPrefix', " +
|
||||||
"separator='$separator'" +
|
"separator='$separator', " +
|
||||||
")"
|
')'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue