From 847fa9fdd90b858b456e14f0e1a4602f9b076ab6 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Mon, 20 Oct 2025 13:47:12 -0700 Subject: [PATCH 1/4] chore(bazel): move capnp dep to bzlmod pre-factoring for --noenable_workspace and Bazel 9 --- WORKSPACE | 4 ---- build/deps/deps.MODULE.bazel | 8 ++++++++ build/deps/deps.jsonc | 13 ------------- build/deps/gen/dep_capnp_cpp.bzl | 18 ------------------ build/deps/gen/deps.bzl | 6 ------ build/deps/update-deps.py | 2 +- 6 files changed, 9 insertions(+), 42 deletions(-) delete mode 100644 build/deps/deps.jsonc delete mode 100644 build/deps/gen/dep_capnp_cpp.bzl delete mode 100644 build/deps/gen/deps.bzl diff --git a/WORKSPACE b/WORKSPACE index 7438cdc962b..a549b4f9bd8 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -8,10 +8,6 @@ load("@//build/deps:gen/shared_deps.bzl", shared_deps_gen = "deps_gen") shared_deps_gen() -load("@//build/deps:gen/deps.bzl", "deps_gen") - -deps_gen() - # ======================================================================================== # Rust bootstrap diff --git a/build/deps/deps.MODULE.bazel b/build/deps/deps.MODULE.bazel index ccc7ce3cf78..0394b287328 100644 --- a/build/deps/deps.MODULE.bazel +++ b/build/deps/deps.MODULE.bazel @@ -105,6 +105,14 @@ archive_override( # Libraries which are not on the BCR http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +http_archive( + name = "capnp-cpp", + url = "https://github.com/capnproto/capnproto/tarball/164284a476eee4bfbcf7cce2a9a82fb156504210", + strip_prefix = "capnproto-capnproto-164284a/c++", + type = "tgz", + sha256 = "03f11165d64c0941c66e749554d3eaf0ea29b6ebe445a82e21557dc68caf6e28", +) + http_archive( name = "nbytes", build_file = "//:build/BUILD.nbytes", diff --git a/build/deps/deps.jsonc b/build/deps/deps.jsonc deleted file mode 100644 index b6db54be031..00000000000 --- a/build/deps/deps.jsonc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "deps.schema.json", - "repositories": [ - { - "name": "capnp-cpp", - "type": "github_tarball", - "owner": "capnproto", - "repo": "capnproto", - "branch": "v2", - "extra_strip_prefix": "/c++" - } - ] -} diff --git a/build/deps/gen/dep_capnp_cpp.bzl b/build/deps/gen/dep_capnp_cpp.bzl deleted file mode 100644 index ba7bb56e2a5..00000000000 --- a/build/deps/gen/dep_capnp_cpp.bzl +++ /dev/null @@ -1,18 +0,0 @@ -# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT - -load("@//:build/http.bzl", "http_archive") - -URL = "https://github.com/capnproto/capnproto/tarball/164284a476eee4bfbcf7cce2a9a82fb156504210" -STRIP_PREFIX = "capnproto-capnproto-164284a/c++" -SHA256 = "03f11165d64c0941c66e749554d3eaf0ea29b6ebe445a82e21557dc68caf6e28" -TYPE = "tgz" -COMMIT = "164284a476eee4bfbcf7cce2a9a82fb156504210" - -def dep_capnp_cpp(): - http_archive( - name = "capnp-cpp", - url = URL, - strip_prefix = STRIP_PREFIX, - type = TYPE, - sha256 = SHA256, - ) diff --git a/build/deps/gen/deps.bzl b/build/deps/gen/deps.bzl deleted file mode 100644 index ce9b1fa8446..00000000000 --- a/build/deps/gen/deps.bzl +++ /dev/null @@ -1,6 +0,0 @@ -# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT - -load("@//build/deps:gen/dep_capnp_cpp.bzl", "dep_capnp_cpp") - -def deps_gen(): - dep_capnp_cpp() diff --git a/build/deps/update-deps.py b/build/deps/update-deps.py index 797aba35cf0..5c5b5b339b2 100755 --- a/build/deps/update-deps.py +++ b/build/deps/update-deps.py @@ -23,7 +23,7 @@ SCRIPT_DIR = Path(os.environ["BUILD_WORKSPACE_DIRECTORY"]) / "build" / "deps" GEN_DIR = SCRIPT_DIR / "gen" -ALL_DEPS = ["deps.jsonc", "build_deps.jsonc", "shared_deps.jsonc"] +ALL_DEPS = ["build_deps.jsonc", "shared_deps.jsonc"] TOP = "# WARNING: THIS FILE IS AUTOGENERATED BY update-deps.py DO NOT EDIT\n" From 786ed3855a0643741c3a32a9443ac2f47fdec076 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 21 Oct 2025 13:19:54 -0700 Subject: [PATCH 2/4] chore: add a script to update it --- build/deps/deps.MODULE.bazel | 8 ++------ build/deps/update-capnp.sh | 11 +++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100755 build/deps/update-capnp.sh diff --git a/build/deps/deps.MODULE.bazel b/build/deps/deps.MODULE.bazel index 0394b287328..41faed4a470 100644 --- a/build/deps/deps.MODULE.bazel +++ b/build/deps/deps.MODULE.bazel @@ -9,7 +9,6 @@ bazel_dep(name = "brotli", version = "1.1.0") # We want to avoid version skew with v8, so we use identical versions. bazel_dep(name = "fast_float") - archive_override( module_name = "fast_float", build_file_content = """cc_library( @@ -30,7 +29,6 @@ archive_override( ) bazel_dep(name = "fp16") - archive_override( module_name = "fp16", build_file_content = "exports_files(glob([\"**\"]))", @@ -46,7 +44,6 @@ archive_override( ) bazel_dep(name = "highway") - archive_override( module_name = "highway", integrity = "sha256-fvP4kFP1D4jUYDZwu5qRXSUr2TMUztaR3fWRPtvE51s=", @@ -86,7 +83,6 @@ archive_override( ) bazel_dep(name = "tcmalloc", repo_name = "com_google_tcmalloc") - archive_override( module_name = "tcmalloc", integrity = "sha256-29cSZUwbEyiW8Y7FneaAzNNYLHeBmAPqBuIciHeE/u0=", @@ -107,10 +103,10 @@ http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "ht http_archive( name = "capnp-cpp", - url = "https://github.com/capnproto/capnproto/tarball/164284a476eee4bfbcf7cce2a9a82fb156504210", + sha256 = "03f11165d64c0941c66e749554d3eaf0ea29b6ebe445a82e21557dc68caf6e28", strip_prefix = "capnproto-capnproto-164284a/c++", type = "tgz", - sha256 = "03f11165d64c0941c66e749554d3eaf0ea29b6ebe445a82e21557dc68caf6e28", + url = "https://github.com/capnproto/capnproto/tarball/164284a476eee4bfbcf7cce2a9a82fb156504210", ) http_archive( diff --git a/build/deps/update-capnp.sh b/build/deps/update-capnp.sh new file mode 100755 index 00000000000..efab14b6cd2 --- /dev/null +++ b/build/deps/update-capnp.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail + +freeze_commit="${COMMIT:-164284a476eee4bfbcf7cce2a9a82fb156504210}" +sha256="${SHA256:-03f11165d64c0941c66e749554d3eaf0ea29b6ebe445a82e21557dc68caf6e28}" +target="//build/deps/deps.MODULE.bazel:capnp-cpp" + +buildozer "set url \"https://github.com/capnproto/capnproto/tarball/${freeze_commit}\"" $target +buildozer "set strip_prefix \"capnproto-capnproto-${freeze_commit:0:7}/c++\"" $target +buildozer "set sha256 \"${sha256}\"" $target From cbeb875001d709d933ec0ef5b4f65bfa50174169 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 21 Oct 2025 13:25:42 -0700 Subject: [PATCH 3/4] add minimal amount of rust to bzlmod? --- MODULE.bazel | 4 +++- build/deps/{deps.MODULE.bazel => cpp.MODULE.bazel} | 0 build/deps/rust.MODULE.bazel | 1 + build/deps/update-capnp.sh | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) rename build/deps/{deps.MODULE.bazel => cpp.MODULE.bazel} (100%) create mode 100644 build/deps/rust.MODULE.bazel diff --git a/MODULE.bazel b/MODULE.bazel index 975a1a7e48c..1bd3475f96f 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -37,10 +37,12 @@ git_override( # downstream build. bazel_dep(name = "boringssl", version = "0.20251002.0", repo_name = "ssl") -include("//build/deps:deps.MODULE.bazel") +include("//build/deps:cpp.MODULE.bazel") include("//build/deps:nodejs.MODULE.bazel") include("//build/deps:python.MODULE.bazel") +include("//build/deps:rust.MODULE.bazel") + include("//build/deps:v8.MODULE.bazel") diff --git a/build/deps/deps.MODULE.bazel b/build/deps/cpp.MODULE.bazel similarity index 100% rename from build/deps/deps.MODULE.bazel rename to build/deps/cpp.MODULE.bazel diff --git a/build/deps/rust.MODULE.bazel b/build/deps/rust.MODULE.bazel new file mode 100644 index 00000000000..e995db37433 --- /dev/null +++ b/build/deps/rust.MODULE.bazel @@ -0,0 +1 @@ +bazel_dep(name = "rules_rust", version = "0.65.0") diff --git a/build/deps/update-capnp.sh b/build/deps/update-capnp.sh index efab14b6cd2..7bafe13504b 100755 --- a/build/deps/update-capnp.sh +++ b/build/deps/update-capnp.sh @@ -4,7 +4,7 @@ set -o errexit -o nounset -o pipefail freeze_commit="${COMMIT:-164284a476eee4bfbcf7cce2a9a82fb156504210}" sha256="${SHA256:-03f11165d64c0941c66e749554d3eaf0ea29b6ebe445a82e21557dc68caf6e28}" -target="//build/deps/deps.MODULE.bazel:capnp-cpp" +target="//build/deps/cpp.MODULE.bazel:capnp-cpp" buildozer "set url \"https://github.com/capnproto/capnproto/tarball/${freeze_commit}\"" $target buildozer "set strip_prefix \"capnproto-capnproto-${freeze_commit:0:7}/c++\"" $target From 521b7a3bf9108716e5653f26ed4224ca77f5243a Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 22 Oct 2025 15:00:26 -0700 Subject: [PATCH 4/4] make DCAPNP_PRIVATE more robust to repo name mangling under bzlmod you can't assume a given path to external/ repo --- .bazelrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index cb3a4f0e108..ca421e237c6 100644 --- a/.bazelrc +++ b/.bazelrc @@ -318,8 +318,8 @@ build:windows --copt='/Zc:dllexportInlines-' build:parse_headers --features=parse_headers --process_headers_in_dependencies # Silence some capnproto warnings/errors that are not relevant for header parsing build:parse_headers --per_file_copt='.*\.h@-Wno-unused-function,-Wno-pragma-system-header-outside-header' -build:parse_headers --per_file_copt=external/capnp-cpp/src/kj/common.h@-Wno-unreachable-code -build:parse_headers --per_file_copt=external/capnp-cpp/src/capnp/arena.h@-DCAPNP_PRIVATE +build:parse_headers --per_file_copt='external/.*capnp-cpp/src/kj/common.h@-Wno-unreachable-code' +build:parse_headers --per_file_copt='external/.*capnp-cpp/src/capnp/arena.h@-DCAPNP_PRIVATE' # optimized configuration build:opt -c opt