mirror of
https://github.com/openai/codex.git
synced 2026-09-11 20:36:49 +00:00
## 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
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
"""Rules for building release binaries across supported target platforms."""
|
|
|
|
load("@rules_platform//platform_data:defs.bzl", "platform_data")
|
|
|
|
_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 = "@rules_rs//rs/platforms:" + _PLATFORM_TRIPLES[platform],
|
|
target = name,
|
|
tags = ["manual"],
|
|
)
|
|
|
|
native.filegroup(
|
|
name = "release_binaries",
|
|
srcs = [name + "_" + platform for platform in platforms],
|
|
tags = ["manual"],
|
|
)
|