Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ bazel_dep(name = "rules_multirun", version = "0.9.0", dev_dependency = True)
bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)
bazel_dep(name = "rules_pkg", version = "1.2.0", dev_dependency = True)

# Rust toolchains to cross-compile the release artifacts for other Linux CPUs
# from Linux x86_64; see dev/release_artifacts. They target musl, which Rust can
# link statically with its bundled rust-lld, so no C cross toolchain is needed.
# Rust toolchains to build the release artifacts for Linux from Linux x86_64;
# see dev/release_artifacts. They target musl, which Rust can link statically
# with its bundled rust-lld, so no C cross toolchain is needed.
rust = use_extension(
"@rules_rust//rust:extensions.bzl",
"rust",
Expand Down Expand Up @@ -227,13 +227,23 @@ rust.repository_set(
],
target_triple = "riscv64gc-unknown-linux-musl",
)
rust.repository_set(
name = "rust_release_linux",
target_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
"//dev/platforms:musl",
],
target_triple = "x86_64-unknown-linux-musl",
)
use_repo(
rust,
"rust_release_linux__aarch64-unknown-linux-musl__stable",
"rust_release_linux__armv7-unknown-linux-musleabihf__stable",
"rust_release_linux__i686-unknown-linux-musl__stable",
"rust_release_linux__powerpc64le-unknown-linux-musl__stable",
"rust_release_linux__riscv64gc-unknown-linux-musl__stable",
"rust_release_linux__x86_64-unknown-linux-musl__stable",
)

# Registered here so that they take precedence over rules_rust's default
Expand All @@ -245,6 +255,7 @@ register_toolchains(
"@rust_release_linux__i686-unknown-linux-musl__stable//:toolchain",
"@rust_release_linux__powerpc64le-unknown-linux-musl__stable//:toolchain",
"@rust_release_linux__riscv64gc-unknown-linux-musl__stable//:toolchain",
"@rust_release_linux__x86_64-unknown-linux-musl__stable//:toolchain",
dev_dependency = True,
)

Expand Down
3 changes: 2 additions & 1 deletion dev/platforms/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ platform(
)

platform(
name = "x86_64-unknown-linux-gnu",
name = "x86_64-unknown-linux-musl",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
":musl",
],
)

Expand Down
2 changes: 1 addition & 1 deletion dev/release_artifacts/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cross_compiled_files(
"//dev/platforms:i686-unknown-linux-musl",
"//dev/platforms:powerpc64le-unknown-linux-musl",
"//dev/platforms:riscv64gc-unknown-linux-musl",
"//dev/platforms:x86_64-unknown-linux-gnu",
"//dev/platforms:x86_64-unknown-linux-musl",
],
":is_macos_aarch64": ["//dev/platforms:x86_64-apple-darwin"],
":is_windows_x86_64": ["//dev/platforms:i686-pc-windows-msvc"],
Expand Down
2 changes: 1 addition & 1 deletion dev/release_artifacts/release_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def release_files(name, srcs, **kwargs):
machine's, without extra runtime libraries.

The paths, one per line, are relative to the execroot, e.g.
`bazel-out/k8-opt/bin/dev/release_artifacts/foo-x86_64-unknown-linux-gnu`.
`bazel-out/k8-opt/bin/dev/release_artifacts/foo-x86_64-unknown-linux-musl`.
Paths of generated files also resolve from the workspace root through the
`bazel-out` convenience symlink. This lets scripts find the files without
running `bazel cquery`, which re-analyzes the build.
Expand Down
6 changes: 3 additions & 3 deletions tests/workflows/release_artifacts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_generate_artifacts_manifest(tmp_path: Path):
artifacts_dir.mkdir(parents=True)
manifest_file = tmp_path / "artifacts_manifest.bzl"

linux_bin = artifacts_dir / "exe_zip_maker-x86_64-unknown-linux-gnu"
linux_bin = artifacts_dir / "exe_zip_maker-x86_64-unknown-linux-musl"
linux_bin.write_bytes(b"linux-binary-contents")
linux_sha = hashlib.sha256(b"linux-binary-contents").hexdigest()

Expand Down Expand Up @@ -76,9 +76,9 @@ def test_generate_artifacts_manifest(tmp_path: Path):
"@platforms//cpu:x86_64",
"@platforms//os:linux",
],
"name": "exe_zip_maker_x86_64_unknown_linux_gnu",
"name": "exe_zip_maker_x86_64_unknown_linux_musl",
"sha256": linux_sha,
"urls": [f"{base_url}/exe_zip_maker-x86_64-unknown-linux-gnu"],
"urls": [f"{base_url}/exe_zip_maker-x86_64-unknown-linux-musl"],
},
]
}
Expand Down
Loading