Another attempt at fixing the version range parser. #2974
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extends the custom constraint/requirement parser to be able to deal with
and
andor
version ranges as they are used by Elixir and Gleam, like>= 1.2.3 and < 2.0.0
.I first tried to use one of the discussed libraries, but they all had some differences that would've broken some existing tests; there's also some discussion on the previous attempts and the commented out tests in the other PR (#2785). If breaking those cases is acceptable then maybe switching to a library would be an option too. I did change all the places that called directly into
ec_semver
to go through the newrebar_semver
module instead, so it should be easier to swap in the future.This does look at the full constraint, but I figured since rebar has to loop over all available versions anyways trimming them out would be a lot of work for only a marginal performance improvement. Keeping them is likely safer and not that much slower. I've also added some tests for the version range matching, so hopefully everything stays in order.
I did not know which formatting you used here since I'm usually not an erlanger, my editor (Zed) would've done something completely different. I tried to match it manually, but if someone can point me to the formatter to use I can run that.
closes #2364
~ yoshie 💜