-
Notifications
You must be signed in to change notification settings - Fork 5
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
Handy func: since and before #72
Comments
Is there any existing library for comparing versions? |
Version number could be extremely complicated to parse, and there are more than one standard, e.g. SemVer, PVP. |
I think you may want to use this library https://javadoc.io/doc/org.apache.maven/maven-artifact/latest/org/apache/maven/artifact/versioning/package-summary.html |
Here is an overview of version comparison: https://www.baeldung.com/java-comparing-versions I think we need a library which has zero dependencies. |
How about |
@ import $ivy.`org.scala-sbt::librarymanagement-core:1.6.1`
@ import sbt.librarymanagement.VersionNumber
import sbt.librarymanagement.VersionNumber
@ import sbt.librarymanagement.SemanticSelector
import sbt.librarymanagement.SemanticSelector
@ VersionNumber("2.12.5").matchesSemVer(SemanticSelector(">=2.12"))
res3: Boolean = true
@ VersionNumber("2.12.5").matchesSemVer(SemanticSelector(">2.12"))
res4: Boolean = false
@ VersionNumber("2.12.5").matchesSemVer(SemanticSelector("<2.12"))
res5: Boolean = false
@ VersionNumber("2.12.5").matchesSemVer(SemanticSelector("=2.12"))
res6: Boolean = true |
Might be a better API: @enableIf(matchesSemVer(crossScalaBinaryVersion("spark-catalyst"), ">=3.2.1")) |
We may take the API from sbt and the IMPL from just-semver: |
I think enableIf.scala should not depend on any of the libraries. Instead it would be good to let enableIf.scala provide a helper function that accepts a |
Note that when using a library with the
|
Usually, a breaking API change happens on a specific version.
How about using
since
andbefore
But I think it is too verbose, how about:
since
means>=
before
means<
The text was updated successfully, but these errors were encountered: