Skip to content

Commit d4fab03

Browse files
committed
Updates & tweaks
1 parent 6449fd6 commit d4fab03

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,19 @@ for how CC toolchains work in general.
125125

126126
### Requirements
127127

128-
Version attributes can be requirements of the form `latest:<condition>` or `first:<condition>`.
128+
Version attributes can be requirements of the form `first`, `first:<condition>`,
129+
`latest` or `latest:<condition>`.
129130

130-
In case of `latest:`, the latest distribution matching the `condition` will be selected.
131+
In case of `latest`, the latest distribution matching the optional `condition`
132+
will be selected.
131133

132-
In case of `first:`, the first distribution matching the `condition` will be selected.
134+
In case of `first`, the first distribution matching the optional `condition`
135+
will be selected.
133136

134-
The condition consists of a comma separated list of semver version comparisons supporting `<`, `<=`, `>`, `>=`, `==`, `!=`. Examples:
137+
The condition consists of a comma separated list of semver version comparisons
138+
supporting `<`, `<=`, `>`, `>=`, `==`, `!=`. Examples:
135139

140+
- `latest`
136141
- `latest:>=20.1.0`
137142
- `latest:>17.0.4,!=19.1.7,<=20.1.0`
138143
- `first:>=15.0.6,<16`

toolchain/internal/configure.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ load(
3636
_supported_targets = "SUPPORTED_TARGETS",
3737
_toolchain_tools = "toolchain_tools",
3838
)
39-
load("//toolchain/internal:llvm_distributions.bzl", "required_llvm_release_name_rctx")
39+
load("//toolchain/internal:llvm_distributions.bzl", "is_requirement", "required_llvm_release_name_rctx")
4040
load(
4141
"//toolchain/internal:sysroot.bzl",
4242
_default_sysroot_path = "default_sysroot_path",
@@ -80,7 +80,7 @@ def llvm_config_impl(rctx):
8080
if not toolchain_root:
8181
fail("LLVM toolchain root missing for ({}, {})".format(os, arch))
8282
(_key, llvm_version) = _exec_os_arch_dict_value(rctx, "llvm_versions")
83-
if llvm_version.startswith("first") or llvm_version.startswith("latest"):
83+
if is_requirement(llvm_version):
8484
llvm_version, distribution, error = required_llvm_release_name_rctx(rctx, llvm_version)
8585
if error:
8686
fail(error)

toolchain/internal/llvm_distributions.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ def required_llvm_release_name_rctx(rctx, llvm_version):
10181018
host_info = host_info(rctx),
10191019
)
10201020

1021-
def _is_requirement(str):
1021+
def is_requirement(str):
10221022
for prefix in ["first", "latest"]:
10231023
if str == prefix or str.startswith(prefix + ":"):
10241024
return True
@@ -1032,7 +1032,7 @@ def _distribution_urls(rctx):
10321032

10331033
if rctx.attr.distribution == "auto":
10341034
rctx_host_info = host_info(rctx)
1035-
if _is_requirement(llvm_version):
1035+
if is_requirement(llvm_version):
10361036
llvm_version, basename, error = _required_llvm_release_name(
10371037
version_requirements = _parse_version_requirements(llvm_version),
10381038
all_llvm_distributions = all_llvm_distributions,

toolchain/internal/repo.bzl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ llvm_repo_attrs.update({
5050
"llvm_version": attr.string(
5151
doc = ("One of the supported versions of LLVM, e.g. 12.0.0; used with the " +
5252
"`auto` value for the `distribution` attribute, and as a default value " +
53-
"for the `llvm_versions` attribute. This value can be set to `latest` " +
54-
"in order to find the latest LLVM version supported on the OS/arch. " +
55-
"Further, requirements can be provided, e.g. `latest:>=17.0.4,!=19.0.7`."),
53+
"for the `llvm_versions` attribute. This value can be set to `first` or " +
54+
"`latest` in order to find the respective first or latest LLVM version " +
55+
"supported on the OS/arch. Further, requirements can be provided, e.g. " +
56+
"`latest:>=17.0.4,!=19.0.7`."),
5657
),
5758
"extra_llvm_distributions": attr.string_dict(
5859
mandatory = False,

0 commit comments

Comments
 (0)