-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Refactor Version class to make version bumps easier #42668
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
Refactor Version class to make version bumps easier #42668
Conversation
Pinging @elastic/es-core-infra |
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.
Looks good, I left some comments.
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.
Let's also:
- only add for fields named
V_\d+_\d+_\d+
- assert the only field not matching this name is
CURRENT
- assert that the id is only added to the map once (currently it's not because
V_8_0_0
andCURRENT
)
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.
Also, let's assert that the id matches the value derived from the name, so that we can reduce the possibility of error even further!
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.
Let's use a primitive map, ImmutableOpenIntMap
.
@atorok I pushed a commit with my suggestions. |
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.
LGTM, but since I pushed commits I think that @rjernst should review too. 😇
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 is a long needed change, thanks! LGTM
If we want the best tooling available, using an annotation processor would probably be the best bet. Modern IDEs have support for those. I'm generally not a fan of code generation, but if storing version info in a structured file and generating the constants makes version bumping less of a pain then I'm all for it. |
@elasticmachine run elasticsearch-ci/2 |
I’m not a fan either. And anyway @rjernst and me have discussed how to do this across the stack. Code generation isn’t effective here because now we need generators for a bunch of different projects when most version bumps are capably done by |
@elasticmachine run elasticsearch-ci/2 |
1 similar comment
@elasticmachine run elasticsearch-ci/2 |
I'm not sure what happened with the history here, I am rebasing on master to fix it without any additional changes |
1f6ad22
to
24007a8
Compare
With thic change we only have to add one line to add a new version. The intent is to make it less error prone and easier to write a script to automate teh process.
With this change we only have to add one line to add a new version. The intent is to make it less error prone and easier to write a script to automate the process.
With this change we only have to add one line to add a new version. The intent is to make it less error prone and easier to write a script to automate the process.
…lastic#43215) With this change we only have to add one line to add a new version. The intent is to make it less error prone and easier to write a script to automate the process.
With this change we only have to add one line to add a new version.
The intent is to make it less error prone and easier to write a script
to automate the process.
There are tools to generate source code or byte-code that would allow us to
automate version bumps based on a plain list of versions,
but that would create friction with IDEs.
There are also tools that semantically understand java source and are able to reformat it,
but unfortunately there's no existing tooling to edit a java source file.
With this change it should be straight forward to automate it by manipulating the source
as a plain text file.