Updated platform triple mapping to support T3 platforms without `std`. (#2899)

This change allows for the definition of platform constraints without
introducing plumbing in repository rules that would attempt to fetch
artifacts that do not exist.

---------

Co-authored-by: Daniel Wagner-Hall <dwagnerhall@apple.com>
This commit is contained in:
UebelAndre 2024-10-01 13:31:32 -07:00 committed by GitHub
parent fa943c7f16
commit 57d6cfc174
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 101 additions and 73 deletions

View File

@ -75,7 +75,7 @@ use_repo(
"cui__cargo-platform-0.1.4",
"cui__cargo_metadata-0.18.1",
"cui__cargo_toml-0.19.2",
"cui__cfg-expr-0.15.5",
"cui__cfg-expr-0.17.0",
"cui__clap-4.3.11",
"cui__crates-index-2.2.0",
"cui__hex-0.4.3",

View File

@ -69,7 +69,7 @@ alias(
alias(
name = "cfg-expr",
actual = "@cui__cfg-expr-0.15.5//:cfg_expr",
actual = "@cui__cfg-expr-0.17.0//:cfg_expr",
tags = ["manual"],
)

View File

@ -80,7 +80,7 @@ rust_library(
"@rules_rust//rust/platform:x86_64-unknown-none": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
version = "0.15.5",
version = "0.17.0",
deps = [
"@cui__smallvec-1.11.0//:smallvec",
],

View File

@ -301,7 +301,7 @@ _NORMAL_DEPENDENCIES = {
"cargo-platform": Label("@cui__cargo-platform-0.1.4//:cargo_platform"),
"cargo_metadata": Label("@cui__cargo_metadata-0.18.1//:cargo_metadata"),
"cargo_toml": Label("@cui__cargo_toml-0.19.2//:cargo_toml"),
"cfg-expr": Label("@cui__cfg-expr-0.15.5//:cfg_expr"),
"cfg-expr": Label("@cui__cfg-expr-0.17.0//:cfg_expr"),
"clap": Label("@cui__clap-4.3.11//:clap"),
"crates-index": Label("@cui__crates-index-2.2.0//:crates_index"),
"hex": Label("@cui__hex-0.4.3//:hex"),
@ -801,12 +801,12 @@ def crate_repositories():
maybe(
http_archive,
name = "cui__cfg-expr-0.15.5",
sha256 = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3",
name = "cui__cfg-expr-0.17.0",
sha256 = "d0890061c4d3223e7267f3bad2ec40b997d64faac1c2815a4a9d95018e2b9e9c",
type = "tar.gz",
urls = ["https://static.crates.io/crates/cfg-expr/0.15.5/download"],
strip_prefix = "cfg-expr-0.15.5",
build_file = Label("@rules_rust//crate_universe/3rdparty/crates:BUILD.cfg-expr-0.15.5.bazel"),
urls = ["https://static.crates.io/crates/cfg-expr/0.17.0/download"],
strip_prefix = "cfg-expr-0.17.0",
build_file = Label("@rules_rust//crate_universe/3rdparty/crates:BUILD.cfg-expr-0.17.0.bazel"),
)
maybe(
@ -3366,7 +3366,7 @@ def crate_repositories():
struct(repo = "cui__cargo-platform-0.1.4", is_dev_dep = False),
struct(repo = "cui__cargo_metadata-0.18.1", is_dev_dep = False),
struct(repo = "cui__cargo_toml-0.19.2", is_dev_dep = False),
struct(repo = "cui__cfg-expr-0.15.5", is_dev_dep = False),
struct(repo = "cui__cfg-expr-0.17.0", is_dev_dep = False),
struct(repo = "cui__clap-4.3.11", is_dev_dep = False),
struct(repo = "cui__crates-index-2.2.0", is_dev_dep = False),
struct(repo = "cui__hex-0.4.3", is_dev_dep = False),

View File

@ -257,9 +257,9 @@ checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-expr"
version = "0.15.5"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3"
checksum = "d0890061c4d3223e7267f3bad2ec40b997d64faac1c2815a4a9d95018e2b9e9c"
dependencies = [
"smallvec",
]

View File

@ -26,7 +26,7 @@ cargo_metadata = "0.18.1"
cargo_toml = "0.19.2"
cargo-lock = "9.0.0"
cargo-platform = "0.1.4"
cfg-expr = "0.15.5"
cfg-expr = "0.17.0"
clap = { version = "4.3.11", features = ["derive", "env"] }
crates-index = { version = "2.2.0", default-features = false, features = [
"git",

View File

@ -396,7 +396,7 @@ call against the generated workspace. The following table describes how to contr
| <a id="crates_vendor-render_config"></a>render_config | The configuration flags to use for rendering. Use `//crate_universe:defs.bzl\%render_config` to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | `""` |
| <a id="crates_vendor-repository_name"></a>repository_name | The name of the repository to generate for `remote` vendor modes. If unset, the label name will be used | String | optional | `""` |
| <a id="crates_vendor-splicing_config"></a>splicing_config | The configuration flags to use for splicing Cargo maniests. Use `//crate_universe:defs.bzl\%rsplicing_config` to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | `""` |
| <a id="crates_vendor-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | `["aarch64-unknown-linux-gnu", "aarch64-unknown-nixos-gnu", "i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "x86_64-unknown-nixos-gnu", "aarch64-apple-darwin", "aarch64-apple-ios-sim", "aarch64-apple-ios", "aarch64-fuchsia", "aarch64-linux-android", "aarch64-pc-windows-msvc", "arm-unknown-linux-gnueabi", "armv7-linux-androideabi", "armv7-unknown-linux-gnueabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf", "s390x-unknown-linux-gnu", "thumbv7em-none-eabi", "thumbv8m.main-none-eabi", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-unknown-freebsd", "x86_64-unknown-none", "aarch64-unknown-nto-qnx710"]` |
| <a id="crates_vendor-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | `["aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-fuchsia", "aarch64-linux-android", "aarch64-pc-windows-msvc", "aarch64-unknown-linux-gnu", "aarch64-unknown-nixos-gnu", "aarch64-unknown-nto-qnx710", "arm-unknown-linux-gnueabi", "armv7-linux-androideabi", "armv7-unknown-linux-gnueabi", "i686-apple-darwin", "i686-linux-android", "i686-pc-windows-msvc", "i686-unknown-freebsd", "i686-unknown-linux-gnu", "powerpc-unknown-linux-gnu", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf", "s390x-unknown-linux-gnu", "thumbv7em-none-eabi", "thumbv8m.main-none-eabi", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-darwin", "x86_64-apple-ios", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-pc-windows-msvc", "x86_64-unknown-freebsd", "x86_64-unknown-linux-gnu", "x86_64-unknown-nixos-gnu", "x86_64-unknown-none"]` |
| <a id="crates_vendor-vendor_path"></a>vendor_path | The path to a directory to write files into. Absolute paths will be treated as relative to the workspace root | String | optional | `"crates"` |
@ -874,7 +874,7 @@ CARGO_BAZEL_REPIN=1 CARGO_BAZEL_REPIN_ONLY=crate_index bazel sync --only=crate_i
| <a id="crates_repository-rust_toolchain_rustc_template"></a>rust_toolchain_rustc_template | The template to use for finding the host `rustc` binary. `{version}` (eg. '1.53.0'), `{triple}` (eg. 'x86_64-unknown-linux-gnu'), `{arch}` (eg. 'aarch64'), `{vendor}` (eg. 'unknown'), `{system}` (eg. 'darwin'), `{cfg}` (eg. 'exec'), `{channel}` (eg. 'stable'), and `{tool}` (eg. 'cargo.exe') will be replaced in the string if present. | String | optional | `"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"` |
| <a id="crates_repository-rust_version"></a>rust_version | The version of Rust the currently registered toolchain is using. Eg. `1.56.0`, or `nightly/2021-09-08` | String | optional | `"1.81.0"` |
| <a id="crates_repository-splicing_config"></a>splicing_config | The configuration flags to use for splicing Cargo maniests. Use `//crate_universe:defs.bzl\%rsplicing_config` to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | `""` |
| <a id="crates_repository-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | `["aarch64-unknown-linux-gnu", "aarch64-unknown-nixos-gnu", "i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "x86_64-unknown-nixos-gnu", "aarch64-apple-darwin", "aarch64-apple-ios-sim", "aarch64-apple-ios", "aarch64-fuchsia", "aarch64-linux-android", "aarch64-pc-windows-msvc", "arm-unknown-linux-gnueabi", "armv7-linux-androideabi", "armv7-unknown-linux-gnueabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf", "s390x-unknown-linux-gnu", "thumbv7em-none-eabi", "thumbv8m.main-none-eabi", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-unknown-freebsd", "x86_64-unknown-none", "aarch64-unknown-nto-qnx710"]` |
| <a id="crates_repository-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | `["aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-fuchsia", "aarch64-linux-android", "aarch64-pc-windows-msvc", "aarch64-unknown-linux-gnu", "aarch64-unknown-nixos-gnu", "aarch64-unknown-nto-qnx710", "arm-unknown-linux-gnueabi", "armv7-linux-androideabi", "armv7-unknown-linux-gnueabi", "i686-apple-darwin", "i686-linux-android", "i686-pc-windows-msvc", "i686-unknown-freebsd", "i686-unknown-linux-gnu", "powerpc-unknown-linux-gnu", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf", "s390x-unknown-linux-gnu", "thumbv7em-none-eabi", "thumbv8m.main-none-eabi", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-darwin", "x86_64-apple-ios", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-pc-windows-msvc", "x86_64-unknown-freebsd", "x86_64-unknown-linux-gnu", "x86_64-unknown-nixos-gnu", "x86_64-unknown-none"]` |
**ENVIRONMENT VARIABLES**

View File

@ -365,7 +365,7 @@ Generates a repo @crates from a Cargo.toml / Cargo.lock pair
| <a id="crate.from_cargo-generate_binaries"></a>generate_binaries | Whether to generate `rust_binary` targets for all the binary crates in every package. By default only the `rust_library` targets are generated. | Boolean | optional | `False` |
| <a id="crate.from_cargo-generate_build_scripts"></a>generate_build_scripts | Whether or not to generate [cargo build scripts](https://doc.rust-lang.org/cargo/reference/build-scripts.html) by default. | Boolean | optional | `True` |
| <a id="crate.from_cargo-manifests"></a>manifests | A list of Cargo manifests (`Cargo.toml` files). | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="crate.from_cargo-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | `["aarch64-unknown-linux-gnu", "aarch64-unknown-nixos-gnu", "i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "x86_64-unknown-nixos-gnu", "aarch64-apple-darwin", "aarch64-apple-ios-sim", "aarch64-apple-ios", "aarch64-fuchsia", "aarch64-linux-android", "aarch64-pc-windows-msvc", "arm-unknown-linux-gnueabi", "armv7-linux-androideabi", "armv7-unknown-linux-gnueabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf", "s390x-unknown-linux-gnu", "thumbv7em-none-eabi", "thumbv8m.main-none-eabi", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-unknown-freebsd", "x86_64-unknown-none", "aarch64-unknown-nto-qnx710"]` |
| <a id="crate.from_cargo-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | `["aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-fuchsia", "aarch64-linux-android", "aarch64-pc-windows-msvc", "aarch64-unknown-linux-gnu", "aarch64-unknown-nixos-gnu", "aarch64-unknown-nto-qnx710", "arm-unknown-linux-gnueabi", "armv7-linux-androideabi", "armv7-unknown-linux-gnueabi", "i686-apple-darwin", "i686-linux-android", "i686-pc-windows-msvc", "i686-unknown-freebsd", "i686-unknown-linux-gnu", "powerpc-unknown-linux-gnu", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf", "s390x-unknown-linux-gnu", "thumbv7em-none-eabi", "thumbv8m.main-none-eabi", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-darwin", "x86_64-apple-ios", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-pc-windows-msvc", "x86_64-unknown-freebsd", "x86_64-unknown-linux-gnu", "x86_64-unknown-nixos-gnu", "x86_64-unknown-none"]` |
<a id="crate.annotation"></a>
@ -428,7 +428,7 @@ Generates a repo @crates from the defined `spec` tags
| <a id="crate.from_specs-cargo_config"></a>cargo_config | A [Cargo configuration](https://doc.rust-lang.org/cargo/reference/config.html) file. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
| <a id="crate.from_specs-generate_binaries"></a>generate_binaries | Whether to generate `rust_binary` targets for all the binary crates in every package. By default only the `rust_library` targets are generated. | Boolean | optional | `False` |
| <a id="crate.from_specs-generate_build_scripts"></a>generate_build_scripts | Whether or not to generate [cargo build scripts](https://doc.rust-lang.org/cargo/reference/build-scripts.html) by default. | Boolean | optional | `True` |
| <a id="crate.from_specs-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | `["aarch64-unknown-linux-gnu", "aarch64-unknown-nixos-gnu", "i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "x86_64-unknown-nixos-gnu", "aarch64-apple-darwin", "aarch64-apple-ios-sim", "aarch64-apple-ios", "aarch64-fuchsia", "aarch64-linux-android", "aarch64-pc-windows-msvc", "arm-unknown-linux-gnueabi", "armv7-linux-androideabi", "armv7-unknown-linux-gnueabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf", "s390x-unknown-linux-gnu", "thumbv7em-none-eabi", "thumbv8m.main-none-eabi", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-unknown-freebsd", "x86_64-unknown-none", "aarch64-unknown-nto-qnx710"]` |
| <a id="crate.from_specs-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | `["aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-fuchsia", "aarch64-linux-android", "aarch64-pc-windows-msvc", "aarch64-unknown-linux-gnu", "aarch64-unknown-nixos-gnu", "aarch64-unknown-nto-qnx710", "arm-unknown-linux-gnueabi", "armv7-linux-androideabi", "armv7-unknown-linux-gnueabi", "i686-apple-darwin", "i686-linux-android", "i686-pc-windows-msvc", "i686-unknown-freebsd", "i686-unknown-linux-gnu", "powerpc-unknown-linux-gnu", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf", "s390x-unknown-linux-gnu", "thumbv7em-none-eabi", "thumbv8m.main-none-eabi", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-darwin", "x86_64-apple-ios", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-pc-windows-msvc", "x86_64-unknown-freebsd", "x86_64-unknown-linux-gnu", "x86_64-unknown-nixos-gnu", "x86_64-unknown-none"]` |
<a id="crate.spec"></a>

View File

@ -1,6 +0,0 @@
alias(
name = "wasm32",
actual = "@platforms//cpu:wasm32",
deprecation = "Use @platforms//cpu:wasm32 directly instead.",
visibility = ["//visibility:public"],
)

View File

@ -3,7 +3,7 @@
load("@bazel_skylib//lib:selects.bzl", "selects")
load(
":triple_mappings.bzl",
"SUPPORTED_PLATFORM_TRIPLES",
"ALL_PLATFORM_TRIPLES",
"cpu_arch_to_constraints",
"system_to_constraints",
"triple_to_constraint_set",
@ -59,7 +59,7 @@ def declare_config_settings():
actual = ":darwin",
)
all_supported_triples = SUPPORTED_PLATFORM_TRIPLES
all_supported_triples = ALL_PLATFORM_TRIPLES
for triple in all_supported_triples:
native.config_setting(
name = triple,

View File

@ -2,65 +2,99 @@
load("//rust/platform:triple.bzl", "triple")
def _support(*, std = False, host_tools = False):
"""Identify the type of support an associated platform triple has.
The source of truth is:
https://doc.rust-lang.org/nightly/rustc/platform-support.html
Args:
std (bool, optional): Whether or not platform has a standard library artifact.
host_tools (bool, optional): Whether or not platform has host tools artifacts.
Returns:
struct: The parameters above.
"""
return struct(
std = std,
host_tools = host_tools,
)
# All T1 Platforms should be supported, but aren't, see inline notes.
SUPPORTED_T1_PLATFORM_TRIPLES = [
"aarch64-unknown-linux-gnu",
"aarch64-unknown-nixos-gnu", # Same as `aarch64-unknown-linux-gnu` but with `@platforms//os:nixos`.
"i686-apple-darwin",
"i686-pc-windows-msvc",
"i686-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-nixos-gnu", # Same as `x86_64-unknown-linux-gnu` but with `@platforms//os:nixos`.
SUPPORTED_T1_PLATFORM_TRIPLES = {
"aarch64-apple-darwin": _support(std = True, host_tools = True),
"aarch64-unknown-linux-gnu": _support(std = True, host_tools = True),
"aarch64-unknown-nixos-gnu": _support(std = True, host_tools = True), # Same as `aarch64-unknown-linux-gnu` but with `@platforms//os:nixos`.
"i686-apple-darwin": _support(std = True, host_tools = True),
"i686-pc-windows-msvc": _support(std = True, host_tools = True),
"i686-unknown-linux-gnu": _support(std = True, host_tools = True),
"x86_64-apple-darwin": _support(std = True, host_tools = True),
"x86_64-pc-windows-msvc": _support(std = True, host_tools = True),
"x86_64-unknown-linux-gnu": _support(std = True, host_tools = True),
"x86_64-unknown-nixos-gnu": _support(std = True, host_tools = True), # Same as `x86_64-unknown-linux-gnu` but with `@platforms//os:nixos`.
# N.B. These "alternative" envs are not supported, as bazel cannot distinguish between them
# and others using existing @platforms// config_values
#
#"i686-pc-windows-gnu",
#"x86_64-pc-windows-gnu",
]
}
# Some T2 Platforms are supported, provided we have mappings to @platforms// entries.
# See @rules_rust//rust/platform:triple_mappings.bzl for the complete list.
SUPPORTED_T2_PLATFORM_TRIPLES = [
"aarch64-apple-darwin",
"aarch64-apple-ios-sim",
"aarch64-apple-ios",
"aarch64-fuchsia",
"aarch64-linux-android",
"aarch64-pc-windows-msvc",
"arm-unknown-linux-gnueabi",
"armv7-linux-androideabi",
"armv7-unknown-linux-gnueabi",
"i686-linux-android",
"i686-unknown-freebsd",
"powerpc-unknown-linux-gnu",
"riscv32imc-unknown-none-elf",
"riscv64gc-unknown-none-elf",
"s390x-unknown-linux-gnu",
"thumbv7em-none-eabi",
"thumbv8m.main-none-eabi",
"wasm32-unknown-unknown",
"wasm32-wasi",
"x86_64-apple-ios",
"x86_64-fuchsia",
"x86_64-linux-android",
"x86_64-unknown-freebsd",
"x86_64-unknown-none",
]
# Some T2 Platforms are supported, provided we have mappings to `@platforms//...` entries.
# See `@rules_rust//rust/platform:triple_mappings.bzl` for the complete list.
SUPPORTED_T2_PLATFORM_TRIPLES = {
"aarch64-apple-ios": _support(std = True, host_tools = False),
"aarch64-apple-ios-sim": _support(std = True, host_tools = False),
"aarch64-fuchsia": _support(std = True, host_tools = False),
"aarch64-linux-android": _support(std = True, host_tools = False),
"aarch64-pc-windows-msvc": _support(std = True, host_tools = True),
"arm-unknown-linux-gnueabi": _support(std = True, host_tools = True),
"armv7-linux-androideabi": _support(std = True, host_tools = False),
"armv7-unknown-linux-gnueabi": _support(std = True, host_tools = True),
"i686-linux-android": _support(std = True, host_tools = False),
"i686-unknown-freebsd": _support(std = True, host_tools = False),
"powerpc-unknown-linux-gnu": _support(std = True, host_tools = True),
"riscv32imc-unknown-none-elf": _support(std = True, host_tools = False),
"riscv64gc-unknown-none-elf": _support(std = True, host_tools = False),
"s390x-unknown-linux-gnu": _support(std = True, host_tools = True),
"thumbv7em-none-eabi": _support(std = True, host_tools = False),
"thumbv8m.main-none-eabi": _support(std = True, host_tools = False),
"wasm32-unknown-unknown": _support(std = True, host_tools = False),
"wasm32-wasi": _support(std = True, host_tools = False),
"x86_64-apple-ios": _support(std = True, host_tools = False),
"x86_64-fuchsia": _support(std = True, host_tools = False),
"x86_64-linux-android": _support(std = True, host_tools = False),
"x86_64-unknown-freebsd": _support(std = True, host_tools = True),
"x86_64-unknown-none": _support(std = True, host_tools = False),
}
# Note that only platforms with `std` artifacts should be added
# to this list: https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-3
SUPPORTED_T3_PLATFORM_TRIPLES = [
"aarch64-unknown-nto-qnx710",
]
_T3_PLATFORM_TRIPLES = {
"aarch64-unknown-nto-qnx710": _support(std = True, host_tools = False),
"wasm64-unknown-unknown": _support(std = False, host_tools = False),
}
SUPPORTED_PLATFORM_TRIPLES = SUPPORTED_T1_PLATFORM_TRIPLES + SUPPORTED_T2_PLATFORM_TRIPLES + SUPPORTED_T3_PLATFORM_TRIPLES
# The only T3 triples that are supported are ones with at least a stdlib
# artifact. However, it can be useful to know of additional triples so
# this list exists separate from the full list above.
SUPPORTED_T3_PLATFORM_TRIPLES = {
triple: support
for triple, support in _T3_PLATFORM_TRIPLES.items()
if support.std
}
# CPUs that map to a "@platforms//cpu entry
SUPPORTED_PLATFORM_TRIPLES = sorted(
SUPPORTED_T1_PLATFORM_TRIPLES.keys() + SUPPORTED_T2_PLATFORM_TRIPLES.keys() + SUPPORTED_T3_PLATFORM_TRIPLES.keys(),
)
# Represents all platform triples `rules_rust` is configured to handle in some way.
# Note that with T3 platforms some artifacts may not be available which can lead to
# failures in the analysis phase. This list should be used sparingly.
ALL_PLATFORM_TRIPLES = SUPPORTED_T1_PLATFORM_TRIPLES.keys() + SUPPORTED_T2_PLATFORM_TRIPLES.keys() + _T3_PLATFORM_TRIPLES.keys()
# CPUs that map to a `@platforms//cpu` entry
_CPU_ARCH_TO_BUILTIN_PLAT_SUFFIX = {
"aarch64": "aarch64",
"arm": "arm",
"arm64e": "arm64e",
"armv7": "armv7",
"armv7s": None,
"asmjs": None,
@ -83,8 +117,8 @@ _CPU_ARCH_TO_BUILTIN_PLAT_SUFFIX = {
"thumbv7em": "armv7e-m",
"thumbv7m": "armv7-m",
"thumbv8m.main": "armv8-m",
"wasm32": None,
"wasm64": None,
"wasm32": "wasm32",
"wasm64": "wasm64",
"x86_64": "x86_64",
}