name.remal.vcs-auto-version
Plugin class: name.remal.gradle_plugins.plugins.vcs.AutoVcsVersionPlugin
plugins {
id 'name.remal.vcs-auto-version' version '1.5.0'
}
plugins {
id("name.remal.vcs-auto-version") version "1.5.0"
}
The plugin applies name.remal.vcs-operations
plugin.
This plugin sets the project's version based on VCS tags and commits.
The plugin operates with:
- Version tags - tags where versions are stored
- Base version tags - versions are calculated based on the latest base version, which is stored in base version tag
- Version increment - a number which is used to increment the latest version number by. Examples:
1.1
increment by5
equals to1.6
1.1.1
increment by10
equals to1.1.11
Version calculation algorithm examples¶
Git log | Result |
---|---|
Calculated version: 0.2 .
Latest version: 0.1 .
No other modifiers. If incrementVersionByCommitsCount = true , then calculated version is 0.3 , as current commit is the second from the latest version commit.
| |
Calculated version: 0.2.0 .
Latest version: 0.1 .
Latest base version: 0.2 , which is greater then the latest version, so calculated version will be <base version>.0 .
If incrementVersionByCommitsCount = true , then calculated version is 0.2.0 , as the latest base version is used.
| |
Calculated version: 0.2 .
Latest version: 0.1 , as distance to version 0.1 is 1 commit and distance to version 1.0 is 3 commits.
Greatest version: 1.0 , but the latest is alwayes used.
No other modifiers. If incrementVersionByCommitsCount = true , then calculated version is 0.2 .
|
Additionally¶
The plugin creates autoVcsVersion
of type AutoVcsVersionExtension
to configure version calculation.
Also the plugin creates createAutoVcsVersionTag
task, that creates a VCS tag and push it to a remote repository.
name.remal.gradle_plugins.plugins.vcs.AutoVcsVersionExtension
¶
Property | Type | Description |
---|---|---|
incrementVersionByCommitsCount |
Boolean |
Is calculated version increment by commits since previous version enabled. Default value: false . |
incrementVersionBy |
Int |
Increment calculated version additionally by this value. Default value: 0 . |
useLatestVersion |
Boolean |
Use the latest version regardless how many commits there are since the version tag. Default value: false . |
Method | Description |
---|---|
MutableList<String> getVersionTagPrefixes() |
Returns a list of version tag prefixes. Default value: ver- , version- . |
void setVersionTagPrefixes(Collection<String> versionTagPrefixes) |
Sets a list of version tag prefixes. |
void setVersionTagPrefixes(String... versionTagPrefixes) |
Sets a list of version tag prefixes. |
void versionTagPrefix(String versionTagPrefix) |
Adds version tag prefix. |
void versionTagPrefixes(Iterable<String> versionTagPrefixes) |
Adds version tag prefixes. |
void versionTagPrefixes(String... versionTagPrefixes) |
Adds version tag prefixes. |
MutableList<String> getBaseVersionTagPrefixes() |
Returns a list of base version tag prefixes. Default value: ver-base- , version-base- . |
void setBaseVersionTagPrefixes(Collection<String> baseVersionTagPrefixes) |
Sets a list of base version tag prefixes. |
void setBaseVersionTagPrefixes(String... baseVersionTagPrefixes) |
Sets a list of base version tag prefixes. |
void baseVersionTagPrefix(String baseVersionTagPrefix) |
Adds base version tag prefix. |
void baseVersionTagPrefixes(Iterable<String> baseVersionTagPrefixes) |
Adds base version tag prefixes. |
void baseVersionTagPrefixes(String... baseVersionTagPrefixes) |
Adds base version tag prefixes. |