Files
OpenShell/MODULE.bazel
Simon Scatton 1959ea19be build(bazel): establish RFC 0012 Rust reference graph (#2414)
Establish the Phase 1 reference implementation proposed by RFC 0012
while retaining the existing Cargo and Mise workflows during evaluation.

- pin Bazel 9.1.1 and configure Bzlmod, rules_rs, LLVM, protobuf, and
  Rust 1.95 toolchains
- import third-party crates from Cargo metadata and propagate the
  workspace version into Bazel targets
- add library, binary, proc-macro, unit-test, and integration-test
  targets across the supported Rust workspace crates and drivers
- generate protobuf Rust sources and descriptor sets under Bazel while
  preserving Cargo-compatible generated-code imports
- annotate aws-lc-sys and zstd-sys native dependencies, build Z3 4.15.2
  from source, and generate z3-sys bindings
- make CLI and procfs test fixtures available as explicit Bazel inputs
  without relying on fixed host binary paths
- define optimized release targets for Linux x86_64 and aarch64 CLI,
  sandbox, and gateway binaries, plus macOS aarch64 artifacts
- add Bazel, buildifier, and lcov to the Nix development environment

RFC: 0012 (rfc12 branch)
Refs: #2491

Signed-off-by: Simon Scatton <sscatton@nvidia.com>
2026-08-03 09:05:40 +00:00

76 lines
2.2 KiB
Python

bazel_dep(name = "rules_rs", version = "0.0.96")
bazel_dep(name = "bazel_lib", version = "3.2.2")
bazel_dep(name = "llvm", version = "0.8.11")
bazel_dep(name = "platforms", version = "1.1.0")
bazel_dep(name = "rules_cc", version = "0.2.20")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "protobuf", version = "34.0.bcr.1")
include("//bazel/annotations:aws-lc-sys.MODULE.bazel")
include("//bazel/annotations:z3-sys.MODULE.bazel")
include("//bazel/annotations:zstd-sys.MODULE.bazel")
z3_repository = use_repo_rule("//third_party/z3:repositories.bzl", "z3_repository")
z3_repository(
name = "z3",
build_file = "//third_party/z3:BUILD.z3.bazel",
integrity = "sha256-YGAaZ0II/2EDgM8NVhIayGeMRcXE6sOtFNv+kZmOzIo=",
strip_prefix = "z3-z3-4.15.2",
urls = ["https://github.com/Z3Prover/z3/archive/refs/tags/z3-4.15.2.zip"],
)
osx = use_extension("@llvm//extensions:osx.bzl", "osx")
osx.frameworks(
names = [
"CFNetwork",
"CoreFoundation",
"CoreServices",
"DiskArbitration",
"Foundation",
"IOKit",
"Kernel",
"OSLog",
"Security",
"SystemConfiguration",
],
)
workspace_version_repository = use_repo_rule("//bazel:cargo_version.bzl", "workspace_version_repository")
workspace_version_repository(
name = "workspace_version",
manifest = "//:Cargo.toml",
)
toolchains = use_extension("@rules_rs//rs/toolchains:module_extension.bzl", "toolchains")
toolchains.toolchain(
edition = "2024",
version = "1.95.0",
)
use_repo(toolchains, "default_rust_toolchains")
rules_rust = use_extension("@rules_rs//rs:rules_rust.bzl", "rules_rust")
use_repo(rules_rust, "rules_rust")
register_toolchains(
"@default_rust_toolchains//:all",
"@llvm//toolchain:all",
"@rules_rust//extensions/prost:default_prost_toolchain",
)
crate = use_extension("@rules_rs//rs:extensions.bzl", "crate")
crate.from_cargo(
name = "crates",
cargo_lock = "//:Cargo.lock",
cargo_toml = "//:Cargo.toml",
platform_triples = [
"aarch64-apple-darwin",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
],
)
use_repo(crate, "crates")