SemVer

class SemVer(val major: Int, val minor: Int, val patch: Int, val preRelease: PreRelease?, val isSnapshot: Boolean)

A variation of the traditional semantic versioning specification to support -SNAPSHOT and prerelease versions like:

  • 1.0.0

  • 1.0.0-SNAPSHOT

  • 1.0.0-rc.0

  • 1.0.0.rc-0-SNAPSHOT

<valid semver> ::= <version core>
| <version core> "-SNAPSHOT"
| <version core> "-" <pre-release>
| <version core> "-" <pre-release> "-SNAPSHOT"

<version core> ::= <major> "." <minor> "." <patch>

<major> ::= <numeric identifier>

<minor> ::= <numeric identifier>

<patch> ::= <numeric identifier>

<pre-release> ::= <dot-separated pre-release identifiers>

<dot-separated pre-release identifiers> ::= <pre-release identifier>
| <pre-release identifier> "." <dot-separated pre-release identifiers>

<build> ::= <dot-separated build identifiers>

<dot-separated build identifiers> ::= <build identifier>
| <build identifier> "." <dot-separated build identifiers>

<pre-release identifier> ::= <alphanumeric identifier>
| <numeric identifier>

<alphanumeric identifier> ::= <non-digit>
| <non-digit> <identifier characters>
| <identifier characters> <non-digit>
| <identifier characters> <non-digit> <identifier characters>

<numeric identifier> ::= "0"
| <positive digit>
| <positive digit> <digits>

<identifier characters> ::= <identifier character>
| <identifier character> <identifier characters>

<identifier character> ::= <digit>
| <non-digit>

<non-digit> ::= <letter>
| "-"

<digits> ::= <digit>
| <digit> <digits>

<digit> ::= "0"
| <positive digit>

<positive digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

<letter> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J"
| "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T"
| "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d"
| "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n"
| "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x"
| "y" | "z"

Constructors

Link copied to clipboard
constructor(major: Int, minor: Int, patch: Int, preRelease: PreRelease?, isSnapshot: Boolean)

Properties

Link copied to clipboard
Link copied to clipboard
val major: Int
Link copied to clipboard
val minor: Int
Link copied to clipboard
val patch: Int
Link copied to clipboard

Functions

Link copied to clipboard

Bumps the prerelease if any, or the patch else.

Link copied to clipboard
operator fun compareTo(currentVersionParsed: SemVer): Int
Link copied to clipboard
fun SemVer.copy(major: Int = this.major, minor: Int = this.minor, patch: Int = this.patch, preRelease: PreRelease? = this.preRelease, isSnapshot: Boolean = this.isSnapshot): SemVer
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun toString(): String