axion-release-plugin
axion-release-plugin copied to clipboard
How BranchVersionIncrementer works?
Hello. I'm evaluating this plugin, It seems to be just what I needed. Reading the documentation, I am a little bit confused on how the 'BranchVersionIncrementer' works. I have this definition:
versionIncrementer 'incrementMinor'
useHighestVersion = true
branchVersionIncrementer = [
'release/.*' : 'incrementMinor',
'bugfix/.*' : { c -> c.currentVersion.incrementPatchVersion() },
'legacy/.*' : [ 'incrementMinorIfNotOnRelease', [releaseBranchPattern: 'legacy/release.*'] ]
]
How are these increments supposed to be used? When it's invoked markNextVersion?
If I begin with version 1.0.0 and I create the branch bugfix/bug1 and then execute ./gradlew markNextVersion, I expected the version 1.0.1-alpha but I receive 1.1.0-alpha
There is something that I don't understand.
Would someone help me please?
Thanks and good work!
I would say that you probably don't need to use markNextVersion task. It is there to mark future milestones and being able to release snapshots of a new major versions before they are released.
In your case if you are on bugfix/bug1 with last stable version being 1.0.0 after adding any commit currentVersion will print 1.0.1-SNAPSHOT.
Branch version incrementers work only with cV and release. However if you need to automate markNextVersion, you can use command line flag –Pincrementer=incrementPatch to override default incrementer.
Thank you Adam for the fast answer!
I'll check this in my project.
Which incrementer use the command markNextVersion? In my case this one?
versionIncrementer 'incrementMinor'
Why don't use the same defined in branchVersionIncrementer configuration array?
Cheers. Pablo.
markNextVersion uses incrementMinor by default. I don't think there is any reason not to use the same as in branchVersionIncrementer - it was never implemented. However using patch incrementer might have little merit and will only inflate number of tags in your repo.
First version of markNextVersion worked only with -PnextVersion=..., so you had to explicitly state what is the new next version. It was intended to use when opening a new big version like 2.0.0 and to be able to publish 2.0.0-SNAPSHOT versions.
Hi Adam.
The bugfix/bug1 works fine, but I have another question.
I need to generate release branches per client.
If I start in version 1.0.0 I create a branch release/release1 with 1 commit
If I execute ./gradlew cV I get 1.1.0-SNAPSHOT
Then I create a second release branch release/release2 with another commit
If I execute ./gradlew cV I get the same 1.1.0-SNAPSHOT when I expected 1.2.0-SNAPSHOT
It is possible to do this?
I thought that by defining useHighestVersion = true I would get what I expected. Of course I can force the version, but would be nice to get it automatically.
I think I misunderstood something.
Please, can you explain me?
Thanks a lot!
Pablo.
It will not work as you expect because of how Git works. When looking for tags in repository, axion has access only to current branch and it traverses commit tree in current branch. It does not switch branches in any way.
So to see tags in your current branch from other branches they have to be merged. Only then commits holding those branches will become visible.
https://axion-release-plugin.readthedocs.io/en/latest/configuration/version/#first-tag-encountered