Skylib module containing functions for checking Bazel versions.

versions.get

Returns the current Bazel version

versions.parse

Parses a version string into a 3-tuple of ints

int tuples can be compared directly using binary operators (<, >).

PARAMETERS

NameDescriptionDefault Value
bazel_versionthe Bazel version stringnone

RETURNS

An int 3-tuple of a (major, minor, patch) version.

versions.check

Check that the version of Bazel is valid within the specified range.

PARAMETERS

NameDescriptionDefault Value
minimum_bazel_versionminimum version of Bazel expectednone
maximum_bazel_versionmaximum version of Bazel expectedNone
bazel_versionthe version of Bazel to check. Used for testing, defaults to native.bazel_versionNone

versions.is_at_most

Check that a version is lower or equals to a threshold.

PARAMETERS

NameDescriptionDefault Value
thresholdthe maximum version stringnone
versionthe version string to be compared to the thresholdnone

RETURNS

True if version <= threshold.

versions.is_at_least

Check that a version is higher or equals to a threshold.

PARAMETERS

NameDescriptionDefault Value
thresholdthe minimum version stringnone
versionthe version string to be compared to the thresholdnone

RETURNS

True if version >= threshold.