Skip to content
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

Handle multi-line latest cli file #631

Closed
romain-grecourt opened this issue Jan 26, 2022 · 1 comment · Fixed by #633
Closed

Handle multi-line latest cli file #631

romain-grecourt opened this issue Jan 26, 2022 · 1 comment · Fixed by #633
Labels
Milestone

Comments

@romain-grecourt
Copy link
Contributor

romain-grecourt commented Jan 26, 2022

Handle the latest metadata file to contain multiple lines.
Add a predicate mechanism to restrict versions per cli versions.

The predicate mechanism is included in the latest file.

E.g.

2.4.1
3.4.12

# Selection rules.
#   The CLI selects the one rule that applies to itself based on its version
#   and filters out the latest from the list above.
#
# Version range works as follows:
#   [1.0,2.0) versions 1.0 (included) to 2.0 (not included)
#   [1.0,2.0] versions 1.0 to 2.0 (both included)
#   [1.5,) versions 1.5 and higher
#   (,1.0],[1.2,) versions up to 1.0 (included) and 1.2 or higher
#
# Notes:
#   1 == 1.0 == 1.0.0
#   X-alpha is the lowest version of X

cli.[2-alpha,3-alpha).latest=[2-alpha,3-alpha)
cli.[3-alpha,).latest=[3-alpha,)

This is based on the behavior of the Maven versioning and the implementation that we already ship with our copy of ComparableVersion.

The range is implemented in a class called VersionRange, we will need to copy that class over as well.

The implementation that filters the lines in the latest file should be flexible and simply apply the predicate matching the current cli against the lines in the latest file and take the first matching. If there is no predicate, just take the first line.

The contract of having 2.x being first will be honored in the published file in helidon.io, however it's only truly implemented in the 2.x CLI. The 3.x CLI will be flexible in order to be future proof.

@romain-grecourt romain-grecourt added this to the 3.0.0-M3 milestone Jan 26, 2022
@romain-grecourt romain-grecourt changed the title Handle multi-line latest metadata Handle multi-line latest cli file Jan 27, 2022
@romain-grecourt
Copy link
Contributor Author

Latest version handling needs to be done in both plugin and metadata. Since the cli plugin must be standalone we have to deal with code duplication.

Let's investigate if we can solve this problem by using the maven-shade-plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant