Experiment with Bazel as a build system.#2240
Draft
SDAChess wants to merge 18 commits into
Draft
Conversation
Collaborator
Author
|
/ok-to-test f3ac6c8 |
Collaborator
Author
|
/ok-to-test 466d5ae |
1 similar comment
Collaborator
Author
|
/ok-to-test 466d5ae |
466d5ae to
d9dbef3
Compare
Collaborator
Author
|
/ok-to-test d9dbef3 |
Collaborator
Author
|
/ok-to-test 59b2d9c |
b24dfb6 to
d358a8c
Compare
Collaborator
Author
|
/ok-to-test d358a8c |
Nix supplies bazel itself (nix-built, so it runs on NixOS without a loader shim); Bazel supplies all build toolchains. Replaces the old mise toolchain layer and the previous rust/z3 dev shell. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
load_class_schema/load_object_schema read schema files at runtime from
a path baked in via env!("CARGO_MANIFEST_DIR"), which only resolves
inside a source checkout. Under Bazel the baked path points into the
deleted compile sandbox, and cargo-installed binaries have no checkout
at all. Embedding with include_str! makes the crate self-contained and
turns a missing or renamed schema file into a compile error.
Signed-off-by: Simon Scatton <sscatton@nvidia.com>
First real crate on the Bazel build. rust_test(crate = ...) compiles the inline unit tests; schemas ride along as compile_data for include_str!. Also set -Clink-self-contained=no on the musl toolchains: rustc otherwise injects its own bundled crt objects alongside the ones zig cc provides, and the first musl binary link fails with duplicate _start/_init/_fini. With the flag, zig owns the entire C runtime. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
openshell-vfio follows the ocsf template: rust_library plus a rust_test for the inline unit tests. openshell-server-macros is the first rust_proc_macro. Consumers build it for the exec platform via proc_macro_deps, but wildcard builds under a musl --platforms flag would also try a standalone musl variant, which cannot link: a proc-macro is always a dylib and the zig musl toolchain ships no shared unwinder (libgcc_s). Mark the target incompatible with musl platforms so //... sweeps skip it. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
One job, three invocations sharing the bazel server and caches: host tests, then both musl release platforms. setup-bazel is pinned by commit sha (tags are mutable); .bazelversion pins the same bazel the nix devshell provides. Remove the legacy build, packaging, release, and license-header workflows on this branch for now, so bazel checks are the only CI exercising the code. Triage, docs, DCO, and vouch workflows stay. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
build.rs hardcoded ../../proto relative to the manifest and always compiled protoc from source through protobuf-src. Both now come from the environment: OPENSHELL_PROTO_DIR locates the proto tree (cargo sets it in .cargo/config.toml), PROTOC/PROTOC_INCLUDE override the compiler and its well-known-types include root. protobuf-src moves behind the default-on vendored-protoc feature, so plain cargo builds behave as before while other build systems can inject a prebuilt or hermetically built protoc. Also drop the git-describe version stamping: openshell_core::VERSION now always reports CARGO_PKG_VERSION, and release stamping can be reintroduced by the packaging pipeline where needed. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
First crate with a build script. cargo_build_script runs the tonic codegen with protoc built from the protobuf module in the exec configuration; PROTOC_INCLUDE points protoc at the protobuf source tree for the google/protobuf well-known types, staged via the well_known_type_protos filegroup. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
First crate depending on another workspace member: internal deps are explicit labels, only external crates come from all_crate_deps. Core's telemetry feature set matches what cargo's workspace-wide feature unification produces, so the single core target serves all consumers. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
The provider YAML profiles are include_str!-embedded, so they ride along as compile_data via a //providers filegroup. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
Router brings the first cargo-style integration test: tests/ files become their own rust_test crate linked against the library, unlike the inline-test targets which recompile the crate with --test. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
/bin/sleep does not exist on every distro (NixOS ships only /bin/sh in /bin), so the deleted-suffix tests failed on such hosts. Copy /bin/sh instead and keep it alive with the read builtin blocking on a piped stdin, which needs no external binaries at all. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
Skills markdown and rego policies are include_str!-embedded and ride along as compile_data; supervisor-network's inline tests additionally embed testdata fixtures. Core grows the test-helpers feature to match what cargo's workspace feature unification produces for dev builds. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
First rust_binary on the Bazel build, and the payoff target: under --platforms=//:linux_amd64_musl it produces the fully static (no INTERP, no NEEDED) supervisor that gets sideloaded into sandbox images. The integration test receives CARGO_BIN_EXE_openshell-sandbox as a runfiles-relative rootpath baked via rustc_env, with the binary attached as data. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
Registers the zig darwin cc toolchain, an aarch64-apple-darwin rust toolchain, and a //:darwin_arm64 platform. Toolchain resolution works and pure-Rust rlibs cross-compile from Linux; crates whose C dependencies do not build for mach-o (aws-lc-sys) and anything linking Apple frameworks still fail — real macOS artifacts stay on Apple hardware for now. Signed-off-by: Simon Scatton <sscatton@nvidia.com>
Signed-off-by: Simon Scatton <sscatton@nvidia.com>
Signed-off-by: Simon Scatton <sscatton@nvidia.com>
d358a8c to
6a39474
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related Issue
Changes
Testing
mise run pre-commitpassesChecklist