- Documentation (2.4.0-rc1)
- Release Notes
- Settings Files
- Ivy Files
- Ant Tasks
- post resolve tasks
- Using standalone
- Developer doc
since 1.4 The buildnumber task is similar to the ant buildnumber task, except that it uses ivy repository to find what is the latest version and calculate a new one for you.
When called it sets four properties according to what has been found.
These properties are:
- ivy.revision the last revision found in the repository
- ivy.new.revision the new revision calculated from the last one (see below)
- ivy.build.number the build number found in the repository
- ivy.new.build.number the new build number calculated from the last one, usually with +1
ivy.revision can be not set if no revision was found
ivy.build.number can be not set if no revision was found or if no number was found in it
ivy.new.build.number can be not set if the default new revision to use when no revision is found do not contain any number
The new revision is calculated using a somewhat complex to explain but very easy to use algorithm, depending on which latest version you asked.
Indeed you can ask for a new revision based upon the latest found for a particular prefix (the revision asked), then the new revision will be the one immediately after with only the prefix in common. If no prefix is set the very latest version is searched.
Examples (suppose the latest version of the module is 1.3.1):
|2||not set||2.0||not set||0|
|organisation||the organisation of the module for which a new build number should be calculated||Yes|
|module||the name of the module for which a new build number should be calculated||Yes|
|branch||the branch of the module for which a new build number should be calculated||No, defaults to the default branch for this module|
|revision||the revision prefix for which a new build number should be calculated||No, defaults to no prefix (will find the latest version)|
|default||the default revision to assume when no revision prefix is asked and no revision is found||No, defaults to 0|
|defaultBuildNumber||the default build number to use for the first revision||No, defaults to 0|
|revSep||the revision separator to use when no matching revision is found, to separate the revision prefix from the build number||No, defaults to '.'|
|prefix||the prefix to use for the property names set (will be prefix.revision, prefix.new.revision, ...)||No, defaults to ivy|
|settingsRef||A reference to the ivy settings that must be used by this task (since 2.0).||No, 'ivy.instance' is taken by default.|
|resolver||the name of the resolver to use for build number calculation (since 2.1)||No, all available resolvers will be used by default.|
ExamplesHere is how it can be used (suppose 1.3.1 is the latest version of ivy in the repository):
<ivy:buildnumber organisation="apache" module="ivy" />will set 1.3.1 as revision, 1.3.2 as new revision, 1 as build number and 2 as new build number
<ivy:buildnumber organisation="apache" module="ivy" revision="1.3" />will set 1.3.1 as revision, 1.3.2 as new revision, 1 as build number and 2 as new build number
<ivy:buildnumber organisation="apache" module="ivy" revision="1.2" />will set 1.2 as revision, 1.2.1 as new revision, no build number and 1 as new build number
<ivy:buildnumber organisation="apache" module="ivy" revision="1." />will set 1.3.1 as revision, 1.4 as new revision, 3 as build number and 4 as new build number
<ivy:buildnumber organisation="apache" module="ivy" revision="3." />will set no revision, 3.0 as new revision, no build number and 0 as new build number
<ivy:buildnumber organisation="apache" module="ivy" revision="1.4-RC" defaultBuildNumber="1" revSep=""/>If called while no release candidate is in the repository, will set ivy.revision to 1.4-RC1. Then it will increment each time, 1.4-RC2, 1.4-RC3, and so on.