Files
OpenShell/crates/openshell-cli/BUILD.bazel
T
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

144 lines
3.6 KiB
Python

load("@crates//:defs.bzl", "aliases", "all_crate_deps")
load("@rules_rs//rs:rust_binary.bzl", "rust_binary")
load("@rules_rs//rs:rust_library.bzl", "rust_library")
load("@rules_rs//rs:rust_test.bzl", "rust_test")
load("@workspace_version//:version.bzl", "WORKSPACE_VERSION")
rust_library(
name = "openshell-cli",
srcs = glob(
["src/**/*.rs"],
exclude = ["src/main.rs"],
),
aliases = aliases(),
version = WORKSPACE_VERSION,
deps = all_crate_deps(normal = True),
)
rust_binary(
name = "openshell",
srcs = ["src/main.rs"],
aliases = aliases(),
version = WORKSPACE_VERSION,
visibility = ["//visibility:public"],
deps = all_crate_deps(normal = True) + [":openshell-cli"],
)
rust_binary(
name = "fake-forward-process",
testonly = True,
srcs = ["tests/fixtures/fake_forward.rs"],
crate_root = "tests/fixtures/fake_forward.rs",
)
rust_test(
name = "openshell-cli_lib_test",
crate = ":openshell-cli",
deps = all_crate_deps(normal_dev = True),
)
rust_test(
name = "openshell-cli_bin_test",
srcs = ["src/main.rs"],
aliases = aliases(),
version = WORKSPACE_VERSION,
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "ensure_providers_integration_test",
srcs = [
"tests/ensure_providers_integration.rs",
"tests/helpers/mod.rs",
],
aliases = aliases(),
crate_root = "tests/ensure_providers_integration.rs",
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "mtls_integration_test",
srcs = [
"tests/helpers/mod.rs",
"tests/mtls_integration.rs",
],
aliases = aliases(),
crate_root = "tests/mtls_integration.rs",
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "provider_commands_integration_test",
srcs = [
"tests/helpers/mod.rs",
"tests/provider_commands_integration.rs",
],
aliases = aliases(),
crate_root = "tests/provider_commands_integration.rs",
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "sandbox_create_lifecycle_integration_test",
srcs = [
"tests/fixtures/fake_forward.rs",
"tests/helpers/mod.rs",
"tests/sandbox_create_lifecycle_integration.rs",
],
aliases = aliases(),
compile_data = [":openshell"],
crate_root = "tests/sandbox_create_lifecycle_integration.rs",
data = [
":fake-forward-process",
":openshell",
],
env = {
"OPENSHELL_TEST_FAKE_FORWARD_PATH": "$(rootpath :fake-forward-process)",
},
rustc_env = {
"CARGO_BIN_EXE_openshell": "$(rootpath :openshell)",
},
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "sandbox_name_fallback_integration_test",
srcs = [
"tests/helpers/mod.rs",
"tests/sandbox_name_fallback_integration.rs",
],
aliases = aliases(),
crate_root = "tests/sandbox_name_fallback_integration.rs",
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)
rust_test(
name = "sandbox_upload_integration_test",
srcs = ["tests/sandbox_upload_integration.rs"],
aliases = aliases(),
crate_root = "tests/sandbox_upload_integration.rs",
data = [":openshell"],
deps = all_crate_deps(
normal = True,
normal_dev = True,
) + [":openshell-cli"],
)