Files
oh-my-pi/BUILD.bazel
T
can1357 8facd237d5 feat(build): migrated native pipeline to bazel with remote caching
- Replaced the napi-cli/cargo-zigbuild/cargo-xwin/sccache build path with
  Bazel: rules_rust + crate_universe over Cargo.lock, hermetic zig cc
  toolchains (linux-gnu pinned to glibc 2.17, linux-musl), host Xcode for
  darwin, and a repo-local hermetic clang-cl + llvm-ml + xwin toolchain for
  windows-msvc (bazel/toolchains/msvc).
- All eight shipped addons build as //:natives-<target> via the release
  transition in bazel/defs.bzl (opt, thin LTO, cgu=16, stripped, canonical
  .node naming); scripts/bazel-natives.ts is the single driver for local
  dev and CI.
- Rust validation moved to bazel test + clippy aspects (strict workspace
  policy for opted-in crates, default lints elsewhere, mirroring cargo
  semantics) and the rustfmt aspect; cargo stays as the dev-iteration
  surface, with brush-core/brush-builtins promoted to workspace members
  and excluded from cargo dev tasks to keep their historical scope.
- CI caches through an in-cluster bazel-remote action cache (TLS + basic
  auth, cluster-internal only); GitHub-hosted runners never touch the
  infrastructure and use an actions/cache-backed disk cache instead.
- Deleted the hand-rolled caching machinery: ci-target-cache,
  ci-native-artifact-cache, ci-build-native, native-source-hash,
  find-native-artifacts, restore-linux-native, native-prewarm workflow,
  ensure-* toolchain actions, and all sccache/Swatinem wiring.
- Warm native rebuilds drop from ~20 minutes to seconds; a cold client
  with a warm remote cache rebuilds the linux x64 pair in ~2.5 minutes.
2026-07-27 12:22:19 +02:00

59 lines
2.1 KiB
Python

# Shipping pi_natives addons, one per (platform, arch, ISA-variant).
# `bazel build //:natives-<target>` yields the canonically named .node file;
# packages/natives/scripts/build-native.ts copies it into packages/natives/native/.
# Note: musl addons intentionally reuse the plain linux-<arch> filenames — the
# loader never sees gnu and musl side by side; release jobs keep them apart.
load("//bazel:defs.bzl", "native_addon")
package(default_visibility = ["//visibility:public"])
exports_files([
"Cargo.toml",
"Cargo.lock",
"Cargo.Bazel.lock",
"rustfmt.toml",
])
_ADDONS = {
"linux-x64-baseline": ("//bazel/platforms:linux-x64-baseline", "pi_natives.linux-x64-baseline.node"),
"linux-x64-modern": ("//bazel/platforms:linux-x64-modern", "pi_natives.linux-x64-modern.node"),
"linux-arm64": ("//bazel/platforms:linux-arm64", "pi_natives.linux-arm64.node"),
"linux-musl-x64-baseline": ("//bazel/platforms:linux-musl-x64-baseline", "pi_natives.linux-x64-baseline.node"),
"linux-musl-arm64": ("//bazel/platforms:linux-musl-arm64", "pi_natives.linux-arm64.node"),
"darwin-x64-baseline": ("//bazel/platforms:darwin-x64-baseline", "pi_natives.darwin-x64-baseline.node"),
"darwin-arm64": ("//bazel/platforms:darwin-arm64", "pi_natives.darwin-arm64.node"),
"win32-x64-baseline": ("//bazel/platforms:win32-x64-baseline", "pi_natives.win32-x64-baseline.node"),
}
[
native_addon(
name = "natives-" + target,
lib = "//crates/pi-natives:pi_natives",
out = out,
platform = platform,
)
for target, (platform, out) in _ADDONS.items()
]
# Every addon buildable from a linux-x64 host (the omp-kata pods): all linux
# targets plus the msvc cross build. darwin addons build on mac hosts.
filegroup(
name = "natives-linux-all",
srcs = [
":natives-linux-arm64",
":natives-linux-musl-arm64",
":natives-linux-musl-x64-baseline",
":natives-linux-x64-baseline",
":natives-linux-x64-modern",
":natives-win32-x64-baseline",
],
)
filegroup(
name = "natives-darwin-all",
srcs = [
":natives-darwin-arm64",
":natives-darwin-x64-baseline",
],
)