mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-26 06:52:57 +08:00
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>
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
def _workspace_version_repository_impl(repository_ctx):
|
|
in_workspace_package = False
|
|
|
|
for raw_line in repository_ctx.read(repository_ctx.attr.manifest).splitlines():
|
|
line = raw_line.strip()
|
|
|
|
if line.startswith("["):
|
|
in_workspace_package = line == "[workspace.package]"
|
|
continue
|
|
|
|
if not in_workspace_package or not line.startswith("version"):
|
|
continue
|
|
|
|
value = line.split("=", 1)[1].strip()
|
|
if not value.startswith('"') or value.find('"', 1) == -1:
|
|
fail("workspace package version must be a quoted string")
|
|
|
|
version = value[1:value.find('"', 1)]
|
|
repository_ctx.file("BUILD.bazel", 'exports_files(["version.bzl"])\n')
|
|
repository_ctx.file("version.bzl", 'WORKSPACE_VERSION = "{}"\n'.format(version))
|
|
return
|
|
|
|
fail("workspace package version not found in {}".format(repository_ctx.attr.manifest))
|
|
|
|
workspace_version_repository = repository_rule(
|
|
implementation = _workspace_version_repository_impl,
|
|
attrs = {
|
|
"manifest": attr.label(
|
|
allow_single_file = True,
|
|
mandatory = True,
|
|
),
|
|
},
|
|
)
|