aboutsummaryrefslogtreecommitdiff
path: root/docs/versions_doc.md
blob: 898673739513d72bfcadeb2ccc107e258e3f5926 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!-- Generated with Stardoc: http://skydoc.bazel.build -->

Skylib module containing functions for checking Bazel versions.

<a id="versions.get"></a>

## versions.get

<pre>
versions.get()
</pre>

Returns the current Bazel version



<a id="versions.parse"></a>

## versions.parse

<pre>
versions.parse(<a href="#versions.parse-bazel_version">bazel_version</a>)
</pre>

Parses a version string into a 3-tuple of ints

int tuples can be compared directly using binary operators (&lt;, &gt;).

For a development build of Bazel, this returns an unspecified version tuple
that compares higher than any released version.


**PARAMETERS**


| Name  | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="versions.parse-bazel_version"></a>bazel_version |  the Bazel version string   |  none |

**RETURNS**

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


<a id="versions.check"></a>

## versions.check

<pre>
versions.check(<a href="#versions.check-minimum_bazel_version">minimum_bazel_version</a>, <a href="#versions.check-maximum_bazel_version">maximum_bazel_version</a>, <a href="#versions.check-bazel_version">bazel_version</a>)
</pre>

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

**PARAMETERS**


| Name  | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="versions.check-minimum_bazel_version"></a>minimum_bazel_version |  minimum version of Bazel expected   |  none |
| <a id="versions.check-maximum_bazel_version"></a>maximum_bazel_version |  maximum version of Bazel expected   |  <code>None</code> |
| <a id="versions.check-bazel_version"></a>bazel_version |  the version of Bazel to check. Used for testing, defaults to native.bazel_version   |  <code>None</code> |


<a id="versions.is_at_most"></a>

## versions.is_at_most

<pre>
versions.is_at_most(<a href="#versions.is_at_most-threshold">threshold</a>, <a href="#versions.is_at_most-version">version</a>)
</pre>

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

**PARAMETERS**


| Name  | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="versions.is_at_most-threshold"></a>threshold |  the maximum version string   |  none |
| <a id="versions.is_at_most-version"></a>version |  the version string to be compared to the threshold   |  none |

**RETURNS**

True if version &lt;= threshold.


<a id="versions.is_at_least"></a>

## versions.is_at_least

<pre>
versions.is_at_least(<a href="#versions.is_at_least-threshold">threshold</a>, <a href="#versions.is_at_least-version">version</a>)
</pre>

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

**PARAMETERS**


| Name  | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="versions.is_at_least-threshold"></a>threshold |  the minimum version string   |  none |
| <a id="versions.is_at_least-version"></a>version |  the version string to be compared to the threshold   |  none |

**RETURNS**

True if version &gt;= threshold.