Skip to content

proxy-wasm-cpp-host: wire v8_lib engine dep to the //bazel:v8_engine flag - #61

Merged
phlax merged 1 commit into
envoyproxy:mainfrom
dcillera:wire-proxy-wasm-v8-engine
Sep 4, 2026
Merged

phlax merged 1 commit into
envoyproxy:mainfrom
dcillera:wire-proxy-wasm-v8-engine

Conversation

@dcillera

@dcillera dcillera commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

What

Wire the proxy-wasm-cpp-host V8 engine dep to //bazel:v8_engine label_flag so bzlmod consumers can redirect the V8/wee8 engine (e.g. to a prebuilt wee8 from envoy_toolshed) — the same way crypto_lib, wamr_lib, wasmtime_lib and wasmedge_lib are already flag-driven.

Module: [email protected].

Why

The module's patch already declared a //bazel:v8_lib label_flag, but it was dead code: the //:v8_lib cc_library still hardcoded //bazel:wee8_no_pointer_compression, so there was no seam to override the V8 engine in bzlmod (unlike the other engine libs). This is the bzlmod-side counterpart to Envoy's WORKSPACE proxy_wasm_cpp_host.patch, which cannot be applied under bzlmod.

Changes (patches/proxy-wasm-cpp-host.patch)

  • Rewrite the //:v8_lib cc_library dep //bazel:wee8_no_pointer_compression → //bazel:v8_engine.
  • Fix the //bazel:v8_lib flag default @v8//:wee8 → //bazel:wee8_no_pointer_compression. Behaviour-preserving: the default (unoverridden) build keeps building the pointer-compression-disabled V8 that proxy-wasm requires; @v8//:wee8 would have silently enabled pointer compression.
  • Update the patch integrity in source.json.

Validation

Against the pinned upstream archive (f2db56af):

  • git apply --check and patch --dry-run both pass.
  • After applying, //:v8_lib deps //bazel:v8_engine and the flag defaults to //bazel:wee8_no_pointer_compression.
  • source.json integrity self-check matches the edited patch.

…flag

The module's patch already declared a //bazel:v8_engine label_flag but never
used it: the //:v8_lib cc_library still hardcoded //bazel:wee8_no_pointer_compression,
so bzlmod consumers had no seam to redirect the V8 engine (e.g. to a prebuilt
wee8 from envoy_toolshed), unlike the crypto/wamr/wasmtime/wasmedge libs which
were already flag-driven.

The flag is named //bazel:v8_engine to match Envoy's WORKSPACE
proxy_wasm_cpp_host.patch, so a single flag name is the seam in both build modes.

- Rewrite the //:v8_lib cc_library dep //bazel:wee8_no_pointer_compression
  -> //bazel:v8_engine.
- Fix the //bazel:v8_engine flag default @v8//:wee8 -> //bazel:wee8_no_pointer_compression
  so the default (unoverridden) build keeps building the pointer-compression-
  disabled V8 that proxy-wasm requires; @v8//:wee8 would have silently enabled
  pointer compression.
- Update the patch integrity in source.json.

Verified with git apply --check and patch --dry-run against the pinned
upstream archive (f2db56af).

Signed-off-by: Dario Cillerai <[email protected]>
@dcillera
dcillera force-pushed the wire-proxy-wasm-v8-engine branch from f52bfa3 to d8a800e Compare September 4, 2026 08:45
@dcillera dcillera changed the title proxy-wasm-cpp-host: wire v8_lib engine dep to the //bazel:v8_lib flag proxy-wasm-cpp-host: wire v8_lib engine dep to the //bazel:v8_engine flag Sep 4, 2026

@phlax phlax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks @dcillera

@phlax
phlax merged commit 67a86cb into envoyproxy:main Sep 4, 2026
5 checks passed
phlax pushed a commit to envoyproxy/envoy that referenced this pull request Sep 4, 2026
## Commit Message
bazel: consume prebuilt wee8 in bzlmod

## Additional Description
Wires Envoy's **bzlmod** builds to consume the prebuilt V8 wee8 static
library (`libwee8.a`), mirroring what the WORKSPACE build already does
(shipped in #47108). This is the bzlmod counterpart of the WORKSPACE
wee8
prebuilt injection.

Changes:
- **Registry pin** ( `api/.bazelrc`) bumped to
  `4fb0f61a75eb72ffb0b7efaccc72dd9efb6a9dce`, which carries
proxy-wasm-cpp-host's `//bazel:v8_engine` `label_flag` — the bzlmod seam
  for redirecting the V8 engine (envoyproxy/bazel-registry#61).
- **`MODULE.bazel`** registers `wee8_prebuilt_extension` so the
`@wee8_prebuilt_*` repos exist under bzlmod (the extension equivalent of
  the WORKSPACE `setup_wee8_prebuilt()`).
- **Engine flag** pointed at `//bazel:wee8_engine` in `.bazelrc`, so
bzlmod
  builds select the prebuilt while reusing the existing alias that keeps
  gcc/sanitizer builds on the from-source engine.
- Regenerated the root/api/docs/mobile lockfiles.

In WORKSPACE mode the flag already defaults to
`@envoy//bazel:wee8_engine`
via `bazel/proxy_wasm_cpp_host.patch`; the shared `common` `.bazelrc`
line is
now safe in both modes because `//bazel:v8_engine` exists in the
registry
patch as well as the WORKSPACE patch.

## Risk Level
Low — bzlmod wiring only; WORKSPACE behavior unchanged. gcc/sanitizer
builds
continue to build V8 from source via the `wee8_engine` alias fallback.

## Testing
`bazel cquery --enable_bzlmod --noenable_workspace
'deps(@proxy-wasm-cpp-host//:v8_lib)'`
resolves to `@wee8_prebuilt_x86_64//:lib/libwee8.a` with **no**
from-source
`@v8//` remaining in the dep path. Lockfiles regenerated via
`bazel mod ... deps --lockfile_mode=update` (per `ci/do_ci.sh
lockfiles`).

## Docs Changes
N/A

## Release Notes
N/A

## Platform Specific Features
N/A

Signed-off-by: Dario Cillerai <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants