-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Dynamic Versioning SCM plugin #1082
feat: Add Dynamic Versioning SCM plugin #1082
Conversation
d2fad86
to
bb1bbea
Compare
@slawekjaranowski I suddenly keep getting:
Not sure how this build is setup but tried rebuilding all the modules from root with a simple |
Fully implemented and it pass with:
Will squash commits later and change to ready. @slawekjaranowski How does it look? |
382164d
to
90ac453
Compare
be1810a
to
149dcad
Compare
versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DynamicVersioningSCMPlugin.java
Outdated
Show resolved
Hide resolved
versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DynamicVersioningSCMPlugin.java
Outdated
Show resolved
Hide resolved
versions-maven-plugin/src/it/it-dynamic-versioning-scm-tag-0-commits-0-tags/invoker.properties
Outdated
Show resolved
Hide resolved
* Maven plugin that uses SCM/VCS to enable dynamic versioning based on your | ||
* version control system. | ||
* | ||
* @author Jimisola Laursen | ||
* @since 2.17.0 | ||
*/ | ||
@Mojo(name = "set-version-from-scm-tag", defaultPhase = LifecyclePhase.INITIALIZE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goal only discover version based on SCM and set project property with it ...
Most of goals of this plugin manipulate project pom to update it according to goal.
We need to think about name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I'm all ears about the name of the goal as long as the functionality is there. What are your thoughts about the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slawekjaranowski Do you have a suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brainstorming here, but the key elements to get in the goal are at least:
- updates project.version in-memory (dynamic)
- sets version based on tag in scm
Is there another word that set that would indicate that the pom.xml itself is left untouched?
The best I can come up with now are:
- use-dynamic-version-from-scm: execution will use but not set version
- impersonate-dynamic-version-from-scm: sadly, inversionate is not a word ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use-dynamic-version-from-scm
look ok for me 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Let's go with use-dynamic-version-from-scm then.
@slawekjaranowski Would it be possible for us to get this moving so that it can be merged to main before the next release? |
please:
|
a450087
to
72cc356
Compare
Not sure that I'm following. After rebase, I ran
Should be done now. |
Pleas look at https://github.com/mojohaus/versions/actions/runs/9527983742/job/26266186230 Please also rebuild whole project |
61bf8ee
to
db8fd01
Compare
Fixed. |
On CI we don't have a git configuration for user from build log:
So pease set git user in verify scripts ... without |
I can't get it to work with neither environment variables in invoker.properties or git config commands in setup script (you wrote verify, but you meant setup right?). I could have understood if the environment variables were set in a different shell (scope) and not available later on but even when I set git config locally and see that they're set it's not picked up by git . If is set it globally then it works. Any ideas?
[...]
exec('git config init.defaultBranch "main"')
exec('git config user.email "user@example.com"')
exec('git config user.name "User Example"')
exec('git config --list --local')
exec('git init')
exec('git add test.txt')
exec('git commit -m initial-commit')
[...] As you can see below default branch, email and name are shown using
|
Running relevant git commands in setup.py as follows works:
but it's really annoying having to submit it for each command. Please advise if that is a workaround we can use. |
@lfvjimisola - ups ... my fault environment set in invoker.properties are available during test plugin execution
|
I wrote above you reply that it does not work for me in setup.groovy with It works if:
|
I just realized when I saw your commits that I might have executed git config prior to git init 🙄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add goal to list at page: https://www.mojohaus.org/versions/versions-maven-plugin/index.html
We can also add en example page with examples - what version will be set according to git repo content.
versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DynamicVersioningSCMPlugin.java
Outdated
Show resolved
Hide resolved
versions-maven-plugin/src/it/it-dynamic-versioning-scm-tag-property-name/invoker.properties
Outdated
Show resolved
Hide resolved
74909ce
to
8fb2a24
Compare
ok, looks good enough open questions:
|
5eee8dc
to
49ef3f7
Compare
9fa2645
to
3dc48bf
Compare
FYI, there is a discrepancy between the goals listed in https://www.mojohaus.org/versions/versions-maven-plugin/#goals-overview and https://www.mojohaus.org/versions/versions-maven-plugin/plugin-info.html Is there a reason why Single Source of Truth (SSOT) and only the auto-generated list is used? |
You right you can think about to drop manual docs at all in order to use generated one. |
Thank you @slawekjaranowski |
@lfvjimisola thanks also for contributing - I will release next version in a few days |
Adds dynamic versioning based on SCM tag (git supported for now). This plugin goal differs from other Versions Maven Plugin goals since it does not change the pom.xml but simply updates project.version in-memory during execution.
Closes: #1071