xref: /aosp_15_r20/external/bazel-skylib/docs/versions_doc.md (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1*bcb5dc79SHONG Yifan<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2*bcb5dc79SHONG Yifan
3*bcb5dc79SHONG YifanSkylib module containing functions for checking Bazel versions.
4*bcb5dc79SHONG Yifan
5*bcb5dc79SHONG Yifan<a id="versions.check"></a>
6*bcb5dc79SHONG Yifan
7*bcb5dc79SHONG Yifan## versions.check
8*bcb5dc79SHONG Yifan
9*bcb5dc79SHONG Yifan<pre>
10*bcb5dc79SHONG Yifanversions.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>)
11*bcb5dc79SHONG Yifan</pre>
12*bcb5dc79SHONG Yifan
13*bcb5dc79SHONG YifanCheck that the version of Bazel is valid within the specified range.
14*bcb5dc79SHONG Yifan
15*bcb5dc79SHONG Yifan**PARAMETERS**
16*bcb5dc79SHONG Yifan
17*bcb5dc79SHONG Yifan
18*bcb5dc79SHONG Yifan| Name  | Description | Default Value |
19*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- |
20*bcb5dc79SHONG Yifan| <a id="versions.check-minimum_bazel_version"></a>minimum_bazel_version |  minimum version of Bazel expected   |  none |
21*bcb5dc79SHONG Yifan| <a id="versions.check-maximum_bazel_version"></a>maximum_bazel_version |  maximum version of Bazel expected   |  `None` |
22*bcb5dc79SHONG Yifan| <a id="versions.check-bazel_version"></a>bazel_version |  the version of Bazel to check. Used for testing, defaults to native.bazel_version   |  `None` |
23*bcb5dc79SHONG Yifan
24*bcb5dc79SHONG Yifan
25*bcb5dc79SHONG Yifan<a id="versions.get"></a>
26*bcb5dc79SHONG Yifan
27*bcb5dc79SHONG Yifan## versions.get
28*bcb5dc79SHONG Yifan
29*bcb5dc79SHONG Yifan<pre>
30*bcb5dc79SHONG Yifanversions.get()
31*bcb5dc79SHONG Yifan</pre>
32*bcb5dc79SHONG Yifan
33*bcb5dc79SHONG YifanReturns the current Bazel version
34*bcb5dc79SHONG Yifan
35*bcb5dc79SHONG Yifan
36*bcb5dc79SHONG Yifan
37*bcb5dc79SHONG Yifan<a id="versions.is_at_least"></a>
38*bcb5dc79SHONG Yifan
39*bcb5dc79SHONG Yifan## versions.is_at_least
40*bcb5dc79SHONG Yifan
41*bcb5dc79SHONG Yifan<pre>
42*bcb5dc79SHONG Yifanversions.is_at_least(<a href="#versions.is_at_least-threshold">threshold</a>, <a href="#versions.is_at_least-version">version</a>)
43*bcb5dc79SHONG Yifan</pre>
44*bcb5dc79SHONG Yifan
45*bcb5dc79SHONG YifanCheck that a version is higher or equals to a threshold.
46*bcb5dc79SHONG Yifan
47*bcb5dc79SHONG Yifan**PARAMETERS**
48*bcb5dc79SHONG Yifan
49*bcb5dc79SHONG Yifan
50*bcb5dc79SHONG Yifan| Name  | Description | Default Value |
51*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- |
52*bcb5dc79SHONG Yifan| <a id="versions.is_at_least-threshold"></a>threshold |  the minimum version string   |  none |
53*bcb5dc79SHONG Yifan| <a id="versions.is_at_least-version"></a>version |  the version string to be compared to the threshold   |  none |
54*bcb5dc79SHONG Yifan
55*bcb5dc79SHONG Yifan**RETURNS**
56*bcb5dc79SHONG Yifan
57*bcb5dc79SHONG YifanTrue if version >= threshold.
58*bcb5dc79SHONG Yifan
59*bcb5dc79SHONG Yifan
60*bcb5dc79SHONG Yifan<a id="versions.is_at_most"></a>
61*bcb5dc79SHONG Yifan
62*bcb5dc79SHONG Yifan## versions.is_at_most
63*bcb5dc79SHONG Yifan
64*bcb5dc79SHONG Yifan<pre>
65*bcb5dc79SHONG Yifanversions.is_at_most(<a href="#versions.is_at_most-threshold">threshold</a>, <a href="#versions.is_at_most-version">version</a>)
66*bcb5dc79SHONG Yifan</pre>
67*bcb5dc79SHONG Yifan
68*bcb5dc79SHONG YifanCheck that a version is lower or equals to a threshold.
69*bcb5dc79SHONG Yifan
70*bcb5dc79SHONG Yifan**PARAMETERS**
71*bcb5dc79SHONG Yifan
72*bcb5dc79SHONG Yifan
73*bcb5dc79SHONG Yifan| Name  | Description | Default Value |
74*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- |
75*bcb5dc79SHONG Yifan| <a id="versions.is_at_most-threshold"></a>threshold |  the maximum version string   |  none |
76*bcb5dc79SHONG Yifan| <a id="versions.is_at_most-version"></a>version |  the version string to be compared to the threshold   |  none |
77*bcb5dc79SHONG Yifan
78*bcb5dc79SHONG Yifan**RETURNS**
79*bcb5dc79SHONG Yifan
80*bcb5dc79SHONG YifanTrue if version <= threshold.
81*bcb5dc79SHONG Yifan
82*bcb5dc79SHONG Yifan
83*bcb5dc79SHONG Yifan<a id="versions.parse"></a>
84*bcb5dc79SHONG Yifan
85*bcb5dc79SHONG Yifan## versions.parse
86*bcb5dc79SHONG Yifan
87*bcb5dc79SHONG Yifan<pre>
88*bcb5dc79SHONG Yifanversions.parse(<a href="#versions.parse-bazel_version">bazel_version</a>)
89*bcb5dc79SHONG Yifan</pre>
90*bcb5dc79SHONG Yifan
91*bcb5dc79SHONG YifanParses a version string into a 3-tuple of ints
92*bcb5dc79SHONG Yifan
93*bcb5dc79SHONG Yifanint tuples can be compared directly using binary operators (<, >).
94*bcb5dc79SHONG Yifan
95*bcb5dc79SHONG YifanFor a development build of Bazel, this returns an unspecified version tuple
96*bcb5dc79SHONG Yifanthat compares higher than any released version.
97*bcb5dc79SHONG Yifan
98*bcb5dc79SHONG Yifan
99*bcb5dc79SHONG Yifan**PARAMETERS**
100*bcb5dc79SHONG Yifan
101*bcb5dc79SHONG Yifan
102*bcb5dc79SHONG Yifan| Name  | Description | Default Value |
103*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- |
104*bcb5dc79SHONG Yifan| <a id="versions.parse-bazel_version"></a>bazel_version |  the Bazel version string   |  none |
105*bcb5dc79SHONG Yifan
106*bcb5dc79SHONG Yifan**RETURNS**
107*bcb5dc79SHONG Yifan
108*bcb5dc79SHONG YifanAn int 3-tuple of a (major, minor, patch) version.
109*bcb5dc79SHONG Yifan
110*bcb5dc79SHONG Yifan
111