RedwoodVersion

@Serializable
value class RedwoodVersion(val value: String) : Comparable<RedwoodVersion>

Version string for the Redwood project. This is a very strict subset of Gradle's version parsing and ordering semantics.

Format is X.Y.Z[-label] (with square brackets indicating an optional part). X, Y, and Z are integers and separated by a period (.). label is an optional string delimited by a hyphen (-) and whose valid characters are a-z, A-Z, 0-9, period (.), underscore (_), and hyphen (-).

Ordering relative to another version string is done by comparing X numerically, then Y numerically, then Z numerically, and finally by comparing label lexicographically. The label value "SNAPSHOT" always sorting higher than any other label. The absence of a label sorts higher than any present label.

Examples:

  • 2.1.0 1.2.3 (X numerically higher)

  • 1.3.1 1.2.0 (X same, Y numerically higher)

  • 1.1.4 1.1.2 (X and Y same, Z numerically higher)

  • 1.0.0 1.0.0-beta (X, Y, and Z same, absent label higher than present label)

  • 1.0.0-SNAPSHOT 1.0.0-beta (X, Y, and Z same, "SNAPSHOT" label higher than any label)

  • 1.0.0-beta 1.0.0-alpha (X, Y, and Z same, "beta" lexicographically higher than "alpha")

  • 1.0.0-beta2 1.0.0-beta (X, Y, and Z same, "beta2" lexicographically higher than "beta")

Constructors

Link copied to clipboard
constructor(value: String)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open operator override fun compareTo(other: RedwoodVersion): Int

Compare two versions to see which is newer.