Use rules_rs platforms for release binaries (#41476)

## What changed

- Map each supported release platform name to its Rust target triple.
- Build multiplatform release binaries against the corresponding `rules_rs`
  platform instead of the LLVM platform definitions.
- Document that `multiplatform_binaries` accepts a subset of the declared
  release platforms.

GitOrigin-RevId: 55e2fb0f92e5fa9e608c10380b1c5d893ca83895
This commit is contained in:
Tamir Duberstein
2026-08-29 05:51:26 +00:00
committed by copyberry
parent 5fc7840cf6
commit 9a0d7a7cd0
+12 -9
View File
@@ -2,20 +2,23 @@
load("@rules_platform//platform_data:defs.bzl", "platform_data")
PLATFORMS = [
"linux_arm64_musl",
"linux_amd64_musl",
"macos_amd64",
"macos_arm64",
"windows_amd64",
"windows_arm64",
]
_PLATFORM_TRIPLES = {
"linux_arm64_musl": "aarch64-unknown-linux-musl",
"linux_amd64_musl": "x86_64-unknown-linux-musl",
"macos_amd64": "x86_64-apple-darwin",
"macos_arm64": "aarch64-apple-darwin",
"windows_amd64": "x86_64-pc-windows-msvc",
"windows_arm64": "aarch64-pc-windows-msvc",
}
PLATFORMS = _PLATFORM_TRIPLES.keys()
def multiplatform_binaries(name, platforms = PLATFORMS):
"""Build a binary for a subset of the declared release platforms."""
for platform in platforms:
platform_data(
name = name + "_" + platform,
platform = "@llvm//platforms:" + platform,
platform = "@rules_rs//rs/platforms:" + _PLATFORM_TRIPLES[platform],
target = name,
tags = ["manual"],
)