Skip to content

Commit 5d26819

Browse files
committed
bzlmod: use --enable_bzlmod by default
Changes from 1e1ebdb: * Adds toolchain * Removes unneeded wasmtime crates imports * Adds wasmsign2-cli crates * Adds patch for rules_rust to avoid staticlib linking issue Notably, this change does not use V8 from BCR because V8's MODULE.bazel file is missing various deps (fp16, simdutf, fast_float, intel_ittapi, dragonbox). Signed-off-by: Matt Leon <mattleon@google.com>
1 parent 454d7a6 commit 5d26819

6 files changed

Lines changed: 4794 additions & 1553 deletions

File tree

.bazelrc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Disable Bzlmod
2-
common --noenable_bzlmod
1+
# Enable Bzlmod
2+
common --enable_bzlmod
33

44
# Pass CC, CXX and PATH from the environment.
55
build --action_env=CC
@@ -70,7 +70,6 @@ build:gcc --action_env=CXX=g++
7070

7171
build:hermetic-llvm --incompatible_enable_cc_toolchain_resolution
7272
build:hermetic-llvm --action_env BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
73-
build:hermetic-llvm --extra_toolchains @emsdk//emscripten_toolchain:cc-toolchain-wasm
7473

7574
build --enable_platform_specific_config
7675

MODULE.bazel

Lines changed: 61 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,59 @@ module(
1717
version = "0.0.0",
1818
)
1919

20-
bazel_dep(name = "envoy", version = "")
21-
2220
bazel_dep(name = "abseil-cpp", version = "20250814.1")
23-
bazel_dep(name = "bazel_features", version = "1.21.0")
24-
bazel_dep(name = "bazel_skylib", version = "1.7.0")
21+
bazel_dep(name = "bazel_features", version = "1.38.0")
22+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
2523
bazel_dep(name = "platforms", version = "1.0.0")
2624
bazel_dep(name = "protobuf", version = "33.2", repo_name = "com_google_protobuf")
2725
bazel_dep(name = "proxy-wasm-cpp-sdk", version = "0.0.0", repo_name = "proxy_wasm_cpp_sdk")
28-
bazel_dep(name = "rules_cc", version = "0.1.5")
26+
bazel_dep(name = "rules_cc", version = "0.2.14")
27+
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
2928
bazel_dep(name = "rules_license", version = "1.0.0")
3029
bazel_dep(name = "rules_python", version = "1.7.0")
3130
bazel_dep(name = "rules_rust", version = "0.68.1")
31+
bazel_dep(name = "rules_fuzzing", version = "0.6.0")
32+
bazel_dep(name = "googletest", version = "1.17.0.bcr.2", repo_name = "com_google_googletest")
33+
bazel_dep(name = "boringssl", version = "0.20251124.0")
34+
bazel_dep(name = "emsdk", version = "4.0.13")
35+
bazel_dep(name = "toolchains_llvm", version = "1.6.0")
3236

33-
git_override(
34-
module_name = "proxy-wasm-cpp-sdk",
35-
commit = "e5256b0c5463ea9961965ad5de3e379e00486640",
36-
remote = "https://github.com/proxy-wasm/proxy-wasm-cpp-sdk",
37-
patch_strip = 1,
38-
patches = ["//bazel:proxy-wasm-cpp-sdk.patch"],
37+
archive_override(
38+
module_name = "rules_rust",
39+
integrity = "sha256-yKqAbPYGZnmsI0YyQe6ArWkiZdrQRl9RERy74wuJA1I=",
40+
patch_args = ["-p1"],
41+
patches = ["@proxy_wasm_cpp_host//bazel/external:rules_rust.patch"],
42+
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.68.1/rules_rust-0.68.1.tar.gz"],
3943
)
4044

41-
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
42-
python.toolchain(
43-
is_default = True,
44-
python_version = "3.12",
45+
archive_override(
46+
module_name = "emsdk",
47+
integrity = "sha256-qRpMH0LbsDRfqsCTFh4n1D6baWSEDYyNgJdquNPq8tM=",
48+
strip_prefix = "emsdk-4.0.23/bazel",
49+
urls = ["https://github.com/emscripten-core/emsdk/archive/refs/tags/4.0.23.tar.gz"],
4550
)
46-
use_repo(
47-
python,
48-
"python_3_12",
49-
python = "python_versions",
51+
52+
emscripten_deps = use_extension(
53+
"@emsdk//:emscripten_deps.bzl",
54+
"emscripten_deps",
5055
)
51-
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
52-
pip.parse(
53-
hub_name = "v8_python_deps",
54-
python_version = "3.12",
55-
requirements_lock = "@v8//:bazel/requirements.txt",
56+
emscripten_deps.config(version = "4.0.23")
57+
58+
archive_override(
59+
module_name = "proxy-wasm-cpp-sdk",
60+
integrity = "sha256-tWCh2ieg06s3RSfpx9+k/mSTiHKZlFvidioFGM41Vw4=",
61+
strip_prefix = "proxy-wasm-cpp-sdk-e5256b0c5463ea9961965ad5de3e379e00486640",
62+
urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/archive/e5256b0c5463ea9961965ad5de3e379e00486640.tar.gz"],
5663
)
57-
use_repo(pip, "v8_python_deps")
64+
65+
# Configure and register the toolchain.
66+
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
67+
llvm.toolchain(
68+
llvm_version = "19.1.0",
69+
)
70+
use_repo(llvm, "llvm_toolchain", "llvm_toolchain_llvm")
71+
72+
register_toolchains("@llvm_toolchain//:all")
5873

5974
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
6075
rust.toolchain(
@@ -65,124 +80,32 @@ use_repo(rust, "rust_toolchains")
6580

6681
register_toolchains("@rust_toolchains//:all")
6782

68-
wasmtime = use_extension("//bazel:extensions.bzl", "wasmtime")
69-
use_repo(wasmtime, "com_github_wasmtime")
83+
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
84+
crate.from_cargo(
85+
name = "wasmsign",
86+
cargo_lockfile = "//bazel/cargo/wasmsign:Cargo.Bazel.lock",
87+
generate_binaries = True,
88+
manifests = ["//bazel/cargo/wasmsign:Cargo.toml"],
89+
)
90+
use_repo(crate, "wasmsign")
7091

92+
# Wasmtime and its dependencies
7193
wasmtime_crates = use_extension("//bazel:extensions.bzl", "wasmtime_crates")
7294
use_repo(
7395
wasmtime_crates,
7496
"cu",
75-
"cu__ahash-0.8.11",
76-
"cu__aho-corasick-1.1.3",
7797
"cu__anyhow-1.0.86",
78-
"cu__arbitrary-1.3.2",
79-
"cu__bitflags-2.6.0",
80-
"cu__bumpalo-3.16.0",
81-
"cu__cc-1.1.7",
82-
"cu__cfg-if-1.0.0",
83-
"cu__cobs-0.2.3",
84-
"cu__cranelift-bforest-0.111.0",
85-
"cu__cranelift-bitset-0.111.0",
86-
"cu__cranelift-codegen-0.111.0",
87-
"cu__cranelift-codegen-meta-0.111.0",
88-
"cu__cranelift-codegen-shared-0.111.0",
89-
"cu__cranelift-control-0.111.0",
90-
"cu__cranelift-entity-0.111.0",
91-
"cu__cranelift-frontend-0.111.0",
92-
"cu__cranelift-isle-0.111.0",
93-
"cu__cranelift-native-0.111.0",
94-
"cu__cranelift-wasm-0.111.0",
95-
"cu__crc32fast-1.4.2",
96-
"cu__either-1.13.0",
97-
"cu__embedded-io-0.4.0",
9898
"cu__env_logger-0.10.2",
99-
"cu__equivalent-1.0.1",
100-
"cu__errno-0.3.9",
101-
"cu__fallible-iterator-0.3.0",
102-
"cu__gimli-0.29.0",
103-
"cu__hashbrown-0.13.2",
104-
"cu__hashbrown-0.14.5",
105-
"cu__heck-0.4.1",
106-
"cu__hermit-abi-0.3.9",
107-
"cu__humantime-2.1.0",
108-
"cu__id-arena-2.2.1",
109-
"cu__indexmap-2.3.0",
110-
"cu__is-terminal-0.4.12",
111-
"cu__itertools-0.12.1",
112-
"cu__itoa-1.0.11",
113-
"cu__leb128-0.2.5",
114-
"cu__libc-0.2.155",
115-
"cu__libm-0.2.8",
116-
"cu__linux-raw-sys-0.4.14",
11799
"cu__log-0.4.22",
118-
"cu__mach2-0.4.2",
119-
"cu__memchr-2.7.4",
120-
"cu__memfd-0.6.4",
121-
"cu__object-0.36.2",
122100
"cu__once_cell-1.19.0",
123-
"cu__paste-1.0.15",
124-
"cu__pin-project-lite-0.2.14",
125-
"cu__postcard-1.0.8",
126-
"cu__proc-macro2-1.0.86",
127-
"cu__psm-0.1.21",
128-
"cu__quote-1.0.36",
129-
"cu__regalloc2-0.9.3",
130-
"cu__regex-1.10.5",
131-
"cu__regex-automata-0.4.7",
132-
"cu__regex-syntax-0.8.4",
133-
"cu__rustc-hash-1.1.0",
134-
"cu__rustix-0.38.34",
135-
"cu__ryu-1.0.18",
136-
"cu__semver-1.0.23",
137-
"cu__serde-1.0.204",
138-
"cu__serde_derive-1.0.204",
139-
"cu__serde_json-1.0.120",
140-
"cu__slice-group-by-0.3.1",
141-
"cu__smallvec-1.13.2",
142-
"cu__sptr-0.3.2",
143-
"cu__stable_deref_trait-1.2.0",
144-
"cu__syn-2.0.72",
145-
"cu__target-lexicon-0.12.16",
146-
"cu__termcolor-1.4.1",
147-
"cu__thiserror-1.0.63",
148-
"cu__thiserror-impl-1.0.63",
149101
"cu__tracing-0.1.40",
150-
"cu__tracing-attributes-0.1.27",
151-
"cu__tracing-core-0.1.32",
152-
"cu__unicode-ident-1.0.12",
153-
"cu__unicode-xid-0.2.4",
154-
"cu__version_check-0.9.5",
155-
"cu__wasm-encoder-0.215.0",
156-
"cu__wasmparser-0.215.0",
157-
"cu__wasmprinter-0.215.0",
158102
"cu__wasmtime-24.0.0",
159-
"cu__wasmtime-asm-macros-24.0.0",
160103
"cu__wasmtime-c-api-macros-24.0.0",
161-
"cu__wasmtime-component-macro-24.0.0",
162-
"cu__wasmtime-component-util-24.0.0",
163-
"cu__wasmtime-cranelift-24.0.0",
164-
"cu__wasmtime-environ-24.0.0",
165-
"cu__wasmtime-jit-icache-coherence-24.0.0",
166-
"cu__wasmtime-slab-24.0.0",
167-
"cu__wasmtime-types-24.0.0",
168-
"cu__wasmtime-versioned-export-macros-24.0.0",
169-
"cu__wasmtime-wit-bindgen-24.0.0",
170-
"cu__winapi-util-0.1.8",
171-
"cu__windows-sys-0.52.0",
172-
"cu__windows-targets-0.52.6",
173-
"cu__windows_aarch64_gnullvm-0.52.6",
174-
"cu__windows_aarch64_msvc-0.52.6",
175-
"cu__windows_i686_gnu-0.52.6",
176-
"cu__windows_i686_gnullvm-0.52.6",
177-
"cu__windows_i686_msvc-0.52.6",
178-
"cu__windows_x86_64_gnu-0.52.6",
179-
"cu__windows_x86_64_gnullvm-0.52.6",
180-
"cu__windows_x86_64_msvc-0.52.6",
181-
"cu__wit-parser-0.215.0",
182-
"cu__zerocopy-0.7.35",
183-
"cu__zerocopy-derive-0.7.35",
184104
)
185105

106+
wasmtime = use_extension("//bazel:extensions.bzl", "wasmtime")
107+
use_repo(wasmtime, "com_github_bytecodealliance_wasmtime")
108+
186109
# WAMR runtime
187110
wamr = use_extension("//bazel:extensions.bzl", "wamr")
188111
use_repo(wamr, "com_github_bytecodealliance_wasm_micro_runtime")
@@ -202,10 +125,15 @@ use_repo(
202125
"simdutf",
203126
)
204127

128+
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
129+
pip.parse(
130+
extra_pip_args = ["--require-hashes"],
131+
hub_name = "v8_python_deps",
132+
python_version = "3.11",
133+
requirements_lock = "@v8//:bazel/requirements.txt",
134+
)
135+
use_repo(pip, "v8_python_deps")
136+
205137
# WasmEdge runtime
206138
wasmedge = use_extension("//bazel:extensions.bzl", "wasmedge")
207139
use_repo(wasmedge, "com_github_wasmedge_wasmedge")
208-
209-
# BoringSSL (for crypto, unless using system crypto)
210-
boringssl = use_extension("//bazel:extensions.bzl", "boringssl")
211-
use_repo(boringssl, "boringssl")

0 commit comments

Comments
 (0)