CI: Customize v8 building (#22086)

## Summary

Move the rusty_v8 artifact production into hermetic Bazel path and bump
the `v8` crate to `147.4.0`

The new flow builds V8 release artifacts from source for Darwin and
Linux targets, publishes both the current release-compatible artifacts
and sandbox-enabled variants, and keeps Cargo consumers on prebuilt
binaries by continuing to feed the `v8` crate the archive and generated
binding files it already expects.

## Why

We need control over V8 build-time features without giving up prebuilt
artifacts for downstream Cargo builds.

Upstream `rusty_v8` already supports source-only features such as
`v8_enable_sandbox`, but its normal prebuilt release assets do not cover
every feature combination we need. Building the artifacts ourselves lets
us enable settings such as the V8 sandbox and pointer compression at
artifact build time, then publish those outputs so ordinary Cargo builds
can still consume prebuilts instead of compiling V8 locally.

This keeps the fast consumer experience of prebuilt `rusty_v8` archives
while giving us a reproducible path to ship featureful variants that
upstream does not currently publish for us.

## Implementation Notes

The Bazel graph in this PR is not copied wholesale from `rusty_v8`;
`rusty_v8`'s normal source build is still GN/Ninja-based.

Instead, this change starts from upstream V8's Bazel rules and adapts
them to Codex's hermetic toolchains and dependency layout. Where we
intentionally follow `rusty_v8`, we mirror its existing artifact
contract:

- the same `v8` crate version and generated binding expectations
- the same sandbox feature relationship, where sandboxing requires
pointer compression
- the same custom libc++ model expected by Cargo's default
`use_custom_libcxx` feature
- the same release-style archive plus `src_binding` outputs consumed by
the `v8` crate

To preserve that contract, the Bazel release path pins the libc++,
libc++abi, and llvm-libc revisions used by `rusty_v8 v147.4.0`, builds
release artifacts with `--config=rusty-v8-upstream-libcxx`, and folds
the matching runtime objects into the final static archive.

## Windows

Windows is annoyingly handled differently.

Codex's current hermetic Bazel Windows C++ platform is `windows-gnullvm`
/ `x86_64-w64-windows-gnu`, while upstream `rusty_v8` publishes Windows
prebuilts for `*-pc-windows-msvc`. Those are different ABIs, so the
Bazel graph cannot truthfully reproduce the upstream MSVC artifacts
until we add a real MSVC-targeting C++ toolchain.

For now:

- Windows MSVC consumers continue to use upstream `rusty_v8` release
archives.
- Windows GNU targets are built in-tree so they link against a matching
GNU ABI.
- The canary workflow separately exercises upstream `rusty_v8` source
builds for MSVC sandbox artifacts, but MSVC is not yet part of the
Bazel-produced release matrix.

## Validation
This PR is technically self validating through CI. I have already
published it as a release tag so the artifacts from this branch are
published to
https://github.com/openai/codex/releases/tag/rusty-v8-v147.4.0 CI for
this PR should therefore consume our own release targets. I have also
locally tested for linux and darwin.

---------

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Channing Conger
2026-05-18 21:33:05 -07:00
committed by GitHub
parent a668379abf
commit 7cdeab33d1
29 changed files with 2173 additions and 454 deletions

View File

@@ -22,57 +22,34 @@ config_setting(
],
)
alias(
name = "v8_146_4_0_x86_64_apple_darwin",
actual = "@rusty_v8_146_4_0_x86_64_apple_darwin_archive//file",
config_setting(
name = "use_rusty_v8_custom_libcxx",
flag_values = {
"@v8//:v8_use_rusty_v8_custom_libcxx": "True",
},
)
alias(
name = "v8_146_4_0_aarch64_apple_darwin",
actual = "@rusty_v8_146_4_0_aarch64_apple_darwin_archive//file",
name = "v8_147_4_0_x86_64_pc_windows_msvc",
actual = "@rusty_v8_147_4_0_x86_64_pc_windows_msvc_archive//file",
)
alias(
name = "v8_146_4_0_x86_64_unknown_linux_gnu",
actual = "@rusty_v8_146_4_0_x86_64_unknown_linux_gnu_archive//file",
name = "v8_147_4_0_aarch64_pc_windows_msvc",
actual = "@rusty_v8_147_4_0_aarch64_pc_windows_msvc_archive//file",
)
alias(
name = "v8_146_4_0_aarch64_unknown_linux_gnu",
actual = "@rusty_v8_146_4_0_aarch64_unknown_linux_gnu_archive//file",
)
alias(
name = "v8_146_4_0_x86_64_unknown_linux_musl",
actual = "@rusty_v8_146_4_0_x86_64_unknown_linux_musl_archive//file",
)
alias(
name = "v8_146_4_0_aarch64_unknown_linux_musl",
actual = "@rusty_v8_146_4_0_aarch64_unknown_linux_musl_archive//file",
)
alias(
name = "v8_146_4_0_x86_64_pc_windows_msvc",
actual = "@rusty_v8_146_4_0_x86_64_pc_windows_msvc_archive//file",
)
alias(
name = "v8_146_4_0_aarch64_pc_windows_msvc",
actual = "@rusty_v8_146_4_0_aarch64_pc_windows_msvc_archive//file",
)
alias(
name = "v8_146_4_0_aarch64_pc_windows_gnullvm",
name = "v8_147_4_0_aarch64_pc_windows_gnullvm",
# `rusty_v8` only ships prebuilt Windows archives for MSVC. Build the
# GNU-flavored archive in-tree so windows-gnullvm consumers can link
# against a matching ABI instead of trying to reuse the MSVC release.
actual = ":v8_146_4_0_aarch64_pc_windows_gnullvm_bazel",
actual = ":v8_147_4_0_aarch64_pc_windows_gnullvm_bazel",
)
alias(
name = "v8_146_4_0_x86_64_pc_windows_gnullvm",
actual = ":v8_146_4_0_x86_64_pc_windows_gnullvm_bazel",
name = "v8_147_4_0_x86_64_pc_windows_gnullvm",
actual = ":v8_147_4_0_x86_64_pc_windows_gnullvm_bazel",
)
filegroup(
@@ -96,80 +73,94 @@ filegroup(
)
alias(
name = "src_binding_release_x86_64_unknown_linux_musl",
actual = "@rusty_v8_146_4_0_x86_64_unknown_linux_musl_binding//file",
)
alias(
name = "src_binding_release_aarch64_unknown_linux_musl",
actual = "@rusty_v8_146_4_0_aarch64_unknown_linux_musl_binding//file",
)
filegroup(
name = "src_binding_release_x86_64_pc_windows_msvc",
srcs = ["@v8_crate_146_4_0//:src_binding_release_x86_64_pc_windows_msvc"],
)
filegroup(
name = "src_binding_release_aarch64_pc_windows_msvc",
srcs = ["@v8_crate_146_4_0//:src_binding_release_aarch64_pc_windows_msvc"],
)
alias(
name = "src_binding_release_x86_64_pc_windows_gnullvm",
name = "src_binding_release_x86_64_pc_windows_gnullvm_147_4_0_release",
# `rusty_v8` does not publish a Windows GNU binding file. The generated
# binding only describes this V8 release's C++ API surface, so reuse the
# Linux release binding while the windows-gnullvm archive build is still
# experimental.
actual = ":src_binding_release_x86_64_unknown_linux_gnu",
actual = ":src_binding_release_x86_64_unknown_linux_gnu_147_4_0_release",
)
alias(
name = "src_binding_release_aarch64_pc_windows_gnullvm",
actual = ":src_binding_release_aarch64_unknown_linux_gnu",
name = "src_binding_release_aarch64_pc_windows_gnullvm_147_4_0_release",
actual = ":src_binding_release_aarch64_unknown_linux_gnu_147_4_0_release",
)
alias(
name = "rusty_v8_archive_for_target",
actual = select({
"@rules_rs//rs/experimental/platforms/config:aarch64-apple-darwin": ":v8_146_4_0_aarch64_apple_darwin_bazel",
"@rules_rs//rs/experimental/platforms/config:aarch64-pc-windows-gnullvm": ":v8_146_4_0_aarch64_pc_windows_gnullvm",
"@rules_rs//rs/experimental/platforms/config:aarch64-pc-windows-msvc": ":v8_146_4_0_aarch64_pc_windows_msvc",
"@rules_rs//rs/experimental/platforms/config:aarch64-unknown-linux-gnu": ":v8_146_4_0_aarch64_unknown_linux_gnu_bazel",
":platform_aarch64_unknown_linux_musl": ":v8_146_4_0_aarch64_unknown_linux_musl_release_base",
"@rules_rs//rs/experimental/platforms/config:x86_64-apple-darwin": ":v8_146_4_0_x86_64_apple_darwin_bazel",
"@rules_rs//rs/experimental/platforms/config:x86_64-pc-windows-gnullvm": ":v8_146_4_0_x86_64_pc_windows_gnullvm",
"@rules_rs//rs/experimental/platforms/config:x86_64-pc-windows-msvc": ":v8_146_4_0_x86_64_pc_windows_msvc",
"@rules_rs//rs/experimental/platforms/config:x86_64-unknown-linux-gnu": ":v8_146_4_0_x86_64_unknown_linux_gnu_bazel",
":platform_x86_64_unknown_linux_musl": ":v8_146_4_0_x86_64_unknown_linux_musl_release",
"//conditions:default": ":v8_146_4_0_x86_64_unknown_linux_gnu_bazel",
"@rules_rs//rs/experimental/platforms/config:aarch64-apple-darwin": ":v8_147_4_0_aarch64_apple_darwin_bazel",
"@rules_rs//rs/experimental/platforms/config:aarch64-pc-windows-gnullvm": ":v8_147_4_0_aarch64_pc_windows_gnullvm",
"@rules_rs//rs/experimental/platforms/config:aarch64-pc-windows-msvc": ":v8_147_4_0_aarch64_pc_windows_msvc",
"@rules_rs//rs/experimental/platforms/config:aarch64-unknown-linux-gnu": ":v8_147_4_0_aarch64_unknown_linux_gnu_bazel",
":platform_aarch64_unknown_linux_musl": ":v8_147_4_0_aarch64_unknown_linux_musl_release_base",
"@rules_rs//rs/experimental/platforms/config:x86_64-apple-darwin": ":v8_147_4_0_x86_64_apple_darwin_bazel",
"@rules_rs//rs/experimental/platforms/config:x86_64-pc-windows-gnullvm": ":v8_147_4_0_x86_64_pc_windows_gnullvm",
"@rules_rs//rs/experimental/platforms/config:x86_64-pc-windows-msvc": ":v8_147_4_0_x86_64_pc_windows_msvc",
"@rules_rs//rs/experimental/platforms/config:x86_64-unknown-linux-gnu": ":v8_147_4_0_x86_64_unknown_linux_gnu_bazel",
":platform_x86_64_unknown_linux_musl": ":v8_147_4_0_x86_64_unknown_linux_musl_release",
"//conditions:default": ":v8_147_4_0_x86_64_unknown_linux_gnu_bazel",
}),
)
alias(
name = "rusty_v8_binding_for_target",
actual = select({
"@rules_rs//rs/experimental/platforms/config:aarch64-apple-darwin": ":src_binding_release_aarch64_apple_darwin",
"@rules_rs//rs/experimental/platforms/config:aarch64-pc-windows-gnullvm": ":src_binding_release_aarch64_pc_windows_gnullvm",
"@rules_rs//rs/experimental/platforms/config:aarch64-pc-windows-msvc": ":src_binding_release_aarch64_pc_windows_msvc",
"@rules_rs//rs/experimental/platforms/config:aarch64-unknown-linux-gnu": ":src_binding_release_aarch64_unknown_linux_gnu",
":platform_aarch64_unknown_linux_musl": ":src_binding_release_aarch64_unknown_linux_musl",
"@rules_rs//rs/experimental/platforms/config:x86_64-apple-darwin": ":src_binding_release_x86_64_apple_darwin",
"@rules_rs//rs/experimental/platforms/config:x86_64-pc-windows-gnullvm": ":src_binding_release_x86_64_pc_windows_gnullvm",
"@rules_rs//rs/experimental/platforms/config:x86_64-pc-windows-msvc": ":src_binding_release_x86_64_pc_windows_msvc",
"@rules_rs//rs/experimental/platforms/config:x86_64-unknown-linux-gnu": ":src_binding_release_x86_64_unknown_linux_gnu",
":platform_x86_64_unknown_linux_musl": ":src_binding_release_x86_64_unknown_linux_musl",
"//conditions:default": ":src_binding_release_x86_64_unknown_linux_gnu",
"@rules_rs//rs/experimental/platforms/config:aarch64-apple-darwin": ":src_binding_release_aarch64_apple_darwin_147_4_0_release",
"@rules_rs//rs/experimental/platforms/config:aarch64-pc-windows-gnullvm": ":src_binding_release_aarch64_pc_windows_gnullvm_147_4_0_release",
"@rules_rs//rs/experimental/platforms/config:aarch64-pc-windows-msvc": ":src_binding_release_aarch64_pc_windows_msvc_147_4_0_release",
"@rules_rs//rs/experimental/platforms/config:aarch64-unknown-linux-gnu": ":src_binding_release_aarch64_unknown_linux_gnu_147_4_0_release",
":platform_aarch64_unknown_linux_musl": ":src_binding_release_aarch64_unknown_linux_musl_147_4_0_release",
"@rules_rs//rs/experimental/platforms/config:x86_64-apple-darwin": ":src_binding_release_x86_64_apple_darwin_147_4_0_release",
"@rules_rs//rs/experimental/platforms/config:x86_64-pc-windows-gnullvm": ":src_binding_release_x86_64_pc_windows_gnullvm_147_4_0_release",
"@rules_rs//rs/experimental/platforms/config:x86_64-pc-windows-msvc": ":src_binding_release_x86_64_pc_windows_msvc_147_4_0_release",
"@rules_rs//rs/experimental/platforms/config:x86_64-unknown-linux-gnu": ":src_binding_release_x86_64_unknown_linux_gnu_147_4_0_release",
":platform_x86_64_unknown_linux_musl": ":src_binding_release_x86_64_unknown_linux_musl_147_4_0_release",
"//conditions:default": ":src_binding_release_x86_64_unknown_linux_gnu_147_4_0_release",
}),
)
V8_COPTS = ["-std=c++20"]
V8_CUSTOM_LIBCXX_COPTS = select({
":use_rusty_v8_custom_libcxx": [
"-nostdinc++",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
"-D_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
],
"//conditions:default": [],
})
V8_STATIC_LIBRARY_FEATURES = [
"-symbol_check",
"-validate-static-library",
]
cc_library(
name = "rusty_v8_custom_libcxx_headers",
defines = select({
":platform_aarch64_unknown_linux_musl": ["ANDROID_HOST_MUSL"],
":platform_x86_64_unknown_linux_musl": ["ANDROID_HOST_MUSL"],
"//conditions:default": [],
}),
deps = [
"@rusty_v8_libcxx//:headers",
"@rusty_v8_libcxxabi//:headers",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "rusty_v8_custom_libcxx_runtime",
deps = [
"@rusty_v8_libcxx//:libcxx",
"@rusty_v8_libcxxabi//:libcxxabi",
],
visibility = ["//visibility:public"],
)
genrule(
name = "binding_cc",
srcs = ["@v8_crate_146_4_0//:binding_cc"],
@@ -210,6 +201,65 @@ cc_library(
],
)
genrule(
name = "binding_cc_147_4_0",
srcs = ["@v8_crate_147_4_0//:binding_cc"],
outs = ["binding_147_4_0.cc"],
cmd = " ".join([
"sed",
"-e '/#include \"v8\\/src\\/flags\\/flags.h\"/d'",
"-e 's|\"v8/src/libplatform/default-platform.h\"|\"src/libplatform/default-platform.h\"|'",
"-e 's|#include \"support.h\"|#include \"support_147_4_0.h\"|'",
"-e 's| namespace i = v8::internal;| (void)usage;|'",
"-e '/using HelpOptions = i::FlagList::HelpOptions;/d'",
"-e '/HelpOptions help_options = HelpOptions(HelpOptions::kExit, usage);/d'",
"-e 's| i::FlagList::SetFlagsFromCommandLine(argc, argv, true, help_options);| v8::V8::SetFlagsFromCommandLine(argc, argv, true);|'",
"$(location @v8_crate_147_4_0//:binding_cc)",
">",
'"$@"',
]),
)
genrule(
name = "crdtp_binding_cc_147_4_0",
srcs = ["@v8_crate_147_4_0//:crdtp_binding_cc"],
outs = ["crdtp_binding_147_4_0.cc"],
cmd = " ".join([
"sed",
"-e 's|#include \"support.h\"|#include \"support_147_4_0.h\"|'",
"-e 's|\"v8/third_party/inspector_protocol/|\"third_party/inspector_protocol/|g'",
"$(location @v8_crate_147_4_0//:crdtp_binding_cc)",
">",
'"$@"',
]),
)
copy_file(
name = "support_h_147_4_0",
src = "@v8_crate_147_4_0//:support_h",
out = "support_147_4_0.h",
)
cc_library(
name = "v8_147_4_0_binding",
srcs = [
":binding_cc_147_4_0",
":crdtp_binding_cc_147_4_0",
],
hdrs = [":support_h_147_4_0"],
copts = V8_COPTS + V8_CUSTOM_LIBCXX_COPTS,
deps = [
"@v8//:core_lib_icu",
"@v8//:rusty_v8_crdtp_headers",
"@v8//:rusty_v8_internal_headers",
] + select({
":use_rusty_v8_custom_libcxx": [
":rusty_v8_custom_libcxx_headers",
],
"//conditions:default": [],
}),
)
cc_static_library(
name = "v8_146_4_0_aarch64_apple_darwin_bazel",
deps = [":v8_146_4_0_binding"],
@@ -292,66 +342,244 @@ filegroup(
srcs = ["@v8_crate_146_4_0//:src_binding_release_x86_64_unknown_linux_gnu"],
)
cc_static_library(
name = "v8_147_4_0_aarch64_apple_darwin_bazel",
deps = [
":rusty_v8_custom_libcxx_runtime",
":v8_147_4_0_binding",
],
features = V8_STATIC_LIBRARY_FEATURES,
)
cc_static_library(
name = "v8_147_4_0_aarch64_unknown_linux_gnu_bazel",
deps = [
":rusty_v8_custom_libcxx_runtime",
":v8_147_4_0_binding",
],
features = V8_STATIC_LIBRARY_FEATURES,
)
cc_static_library(
name = "v8_147_4_0_aarch64_pc_windows_gnullvm_bazel",
deps = [":v8_147_4_0_binding"],
features = V8_STATIC_LIBRARY_FEATURES,
)
cc_static_library(
name = "v8_147_4_0_aarch64_unknown_linux_musl_release_base",
deps = [
":rusty_v8_custom_libcxx_runtime",
":v8_147_4_0_binding",
],
features = V8_STATIC_LIBRARY_FEATURES,
)
genrule(
name = "v8_147_4_0_aarch64_unknown_linux_musl_release",
srcs = [
":v8_147_4_0_aarch64_unknown_linux_musl_release_base",
"@llvm//runtimes/compiler-rt:clang_rt.builtins.static",
],
tools = [
"@llvm//tools:llvm-ar",
"@llvm//tools:llvm-ranlib",
],
outs = ["libv8_147_4_0_aarch64_unknown_linux_musl.a"],
cmd = """
cat > "$(@D)/merge.mri" <<'EOF'
create $@
addlib $(location :v8_147_4_0_aarch64_unknown_linux_musl_release_base)
addlib $(location @llvm//runtimes/compiler-rt:clang_rt.builtins.static)
save
end
EOF
$(location @llvm//tools:llvm-ar) -M < "$(@D)/merge.mri"
$(location @llvm//tools:llvm-ranlib) "$@"
""",
)
cc_static_library(
name = "v8_147_4_0_x86_64_apple_darwin_bazel",
deps = [
":rusty_v8_custom_libcxx_runtime",
":v8_147_4_0_binding",
],
features = V8_STATIC_LIBRARY_FEATURES,
)
cc_static_library(
name = "v8_147_4_0_x86_64_unknown_linux_gnu_bazel",
deps = [
":rusty_v8_custom_libcxx_runtime",
":v8_147_4_0_binding",
],
features = V8_STATIC_LIBRARY_FEATURES,
)
cc_static_library(
name = "v8_147_4_0_x86_64_pc_windows_gnullvm_bazel",
deps = [":v8_147_4_0_binding"],
features = V8_STATIC_LIBRARY_FEATURES,
)
cc_static_library(
name = "v8_147_4_0_x86_64_unknown_linux_musl_release",
deps = [
":rusty_v8_custom_libcxx_runtime",
":v8_147_4_0_binding",
],
features = V8_STATIC_LIBRARY_FEATURES,
)
filegroup(
name = "src_binding_release_aarch64_apple_darwin_147_4_0_release",
srcs = ["@v8_crate_147_4_0//:src_binding_release_aarch64_apple_darwin"],
)
filegroup(
name = "src_binding_release_x86_64_apple_darwin_147_4_0_release",
srcs = ["@v8_crate_147_4_0//:src_binding_release_x86_64_apple_darwin"],
)
filegroup(
name = "src_binding_release_aarch64_unknown_linux_gnu_147_4_0_release",
srcs = ["@v8_crate_147_4_0//:src_binding_release_aarch64_unknown_linux_gnu"],
)
filegroup(
name = "src_binding_release_x86_64_unknown_linux_gnu_147_4_0_release",
srcs = ["@v8_crate_147_4_0//:src_binding_release_x86_64_unknown_linux_gnu"],
)
filegroup(
name = "src_binding_release_aarch64_unknown_linux_musl_147_4_0_release",
srcs = ["@v8_crate_147_4_0//:src_binding_release_aarch64_unknown_linux_gnu"],
)
filegroup(
name = "src_binding_release_x86_64_unknown_linux_musl_147_4_0_release",
srcs = ["@v8_crate_147_4_0//:src_binding_release_x86_64_unknown_linux_gnu"],
)
filegroup(
name = "src_binding_release_aarch64_pc_windows_msvc_147_4_0_release",
srcs = ["@v8_crate_147_4_0//:src_binding_release_aarch64_pc_windows_msvc"],
)
filegroup(
name = "src_binding_release_x86_64_pc_windows_msvc_147_4_0_release",
srcs = ["@v8_crate_147_4_0//:src_binding_release_x86_64_pc_windows_msvc"],
)
filegroup(
name = "rusty_v8_release_pair_x86_64_apple_darwin",
srcs = [
":v8_146_4_0_x86_64_apple_darwin",
":src_binding_release_x86_64_apple_darwin",
":v8_147_4_0_x86_64_apple_darwin_bazel",
":src_binding_release_x86_64_apple_darwin_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_release_pair_aarch64_apple_darwin",
srcs = [
":v8_146_4_0_aarch64_apple_darwin",
":src_binding_release_aarch64_apple_darwin",
":v8_147_4_0_aarch64_apple_darwin_bazel",
":src_binding_release_aarch64_apple_darwin_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_release_pair_x86_64_unknown_linux_gnu",
srcs = [
":v8_146_4_0_x86_64_unknown_linux_gnu",
":src_binding_release_x86_64_unknown_linux_gnu",
":v8_147_4_0_x86_64_unknown_linux_gnu_bazel",
":src_binding_release_x86_64_unknown_linux_gnu_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_release_pair_aarch64_unknown_linux_gnu",
srcs = [
":v8_146_4_0_aarch64_unknown_linux_gnu",
":src_binding_release_aarch64_unknown_linux_gnu",
":v8_147_4_0_aarch64_unknown_linux_gnu_bazel",
":src_binding_release_aarch64_unknown_linux_gnu_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_release_pair_x86_64_unknown_linux_musl",
srcs = [
":v8_146_4_0_x86_64_unknown_linux_musl_release",
":src_binding_release_x86_64_unknown_linux_musl_release",
":v8_147_4_0_x86_64_unknown_linux_musl_release",
":src_binding_release_x86_64_unknown_linux_musl_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_release_pair_aarch64_unknown_linux_musl",
srcs = [
":v8_146_4_0_aarch64_unknown_linux_musl_release",
":src_binding_release_aarch64_unknown_linux_musl_release",
":v8_147_4_0_aarch64_unknown_linux_musl_release",
":src_binding_release_aarch64_unknown_linux_musl_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_release_pair_x86_64_pc_windows_msvc",
srcs = [
":v8_146_4_0_x86_64_pc_windows_msvc",
":src_binding_release_x86_64_pc_windows_msvc",
":v8_147_4_0_x86_64_pc_windows_msvc",
":src_binding_release_x86_64_pc_windows_msvc_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_release_pair_aarch64_pc_windows_msvc",
srcs = [
":v8_146_4_0_aarch64_pc_windows_msvc",
":src_binding_release_aarch64_pc_windows_msvc",
":v8_147_4_0_aarch64_pc_windows_msvc",
":src_binding_release_aarch64_pc_windows_msvc_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_sandbox_release_pair_x86_64_apple_darwin",
srcs = [
":v8_147_4_0_x86_64_apple_darwin_bazel",
":src_binding_release_x86_64_apple_darwin_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_sandbox_release_pair_aarch64_apple_darwin",
srcs = [
":v8_147_4_0_aarch64_apple_darwin_bazel",
":src_binding_release_aarch64_apple_darwin_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_sandbox_release_pair_x86_64_unknown_linux_gnu",
srcs = [
":v8_147_4_0_x86_64_unknown_linux_gnu_bazel",
":src_binding_release_x86_64_unknown_linux_gnu_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_sandbox_release_pair_aarch64_unknown_linux_gnu",
srcs = [
":v8_147_4_0_aarch64_unknown_linux_gnu_bazel",
":src_binding_release_aarch64_unknown_linux_gnu_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_sandbox_release_pair_x86_64_unknown_linux_musl",
srcs = [
":v8_147_4_0_x86_64_unknown_linux_musl_release",
":src_binding_release_x86_64_unknown_linux_musl_147_4_0_release",
],
)
filegroup(
name = "rusty_v8_sandbox_release_pair_aarch64_unknown_linux_musl",
srcs = [
":v8_147_4_0_aarch64_unknown_linux_musl_release",
":src_binding_release_aarch64_unknown_linux_musl_147_4_0_release",
],
)

View File

@@ -20,27 +20,39 @@ artifact contract.
Current pinned versions:
- Rust crate: `v8 = =146.4.0`
- Embedded upstream V8 source for musl release builds: `14.6.202.9`
- Rust crate: `v8 = =147.4.0`
- Embedded upstream V8 source for Bazel-produced release builds: `14.7.173.20`
When bumping the Rust crate version, keep the checked-in checksum manifest and
`MODULE.bazel` in sync:
## Updating to a new `v8` release
Use this as the maintainer flow for a version bump:
1. Bump the `v8` crate version and refresh `codex-rs/Cargo.lock`.
2. Update the Bazel versioned inputs in `MODULE.bazel`, then refresh the
matching checksum manifest and generated checksums as described below.
3. Publish a release-candidate PR and validate that `v8-canary` passes.
4. If the canary is green, publish the release tag and release build.
5. Once the release build completes, rerun the build on the candidate branch
and verify that the final artifact builds and tests pass.
When changing the remaining prebuilt `rusty_v8` `http_file` inputs, keep the
checked-in checksum manifest and `MODULE.bazel` in sync:
```bash
python3 .github/scripts/rusty_v8_bazel.py update-module-bazel
python3 .github/scripts/rusty_v8_bazel.py check-module-bazel
```
The commands read `third_party/v8/rusty_v8_<crate_version>.sha256` by default
and validate every matching `rusty_v8_<crate_version>` `http_file` entry.
CI runs the check command to block checksum drift.
The commands default to the single `rusty_v8_*` `http_file` version still
present in `MODULE.bazel` and validate every matching entry. CI runs the check
command to block checksum drift.
The consumer-facing selectors are:
- `//third_party/v8:rusty_v8_archive_for_target`
- `//third_party/v8:rusty_v8_binding_for_target`
Musl release assets are expected at the tag:
Published release assets are expected at the tag:
- `rusty-v8-v<crate_version>`
@@ -49,13 +61,45 @@ with these raw asset names:
- `librusty_v8_release_<target>.a.gz`
- `src_binding_release_<target>.rs`
The dedicated publishing workflow is `.github/workflows/rusty-v8-release.yml`.
It builds musl release pairs from source and keeps the release artifacts as the
statically linked form:
During the sandbox rollout, sandbox-enabled assets are published alongside those
current assets on the same tag, with the Rust crate's sandbox feature suffix in
their raw names:
- `librusty_v8_ptrcomp_sandbox_release_<target>.a.gz`
- `src_binding_ptrcomp_sandbox_release_<target>.rs`
The dedicated publishing workflow is `.github/workflows/rusty-v8-release.yml`.
Tagged runs build release artifacts from the Bazel graph itself:
- `//third_party/v8:rusty_v8_release_pair_x86_64_apple_darwin`
- `//third_party/v8:rusty_v8_release_pair_aarch64_apple_darwin`
- `//third_party/v8:rusty_v8_release_pair_x86_64_unknown_linux_gnu`
- `//third_party/v8:rusty_v8_release_pair_aarch64_unknown_linux_gnu`
- `//third_party/v8:rusty_v8_release_pair_x86_64_unknown_linux_musl`
- `//third_party/v8:rusty_v8_release_pair_aarch64_unknown_linux_musl`
The same run also builds the matching sandbox pair targets:
- `//third_party/v8:rusty_v8_sandbox_release_pair_x86_64_apple_darwin`
- `//third_party/v8:rusty_v8_sandbox_release_pair_aarch64_apple_darwin`
- `//third_party/v8:rusty_v8_sandbox_release_pair_x86_64_unknown_linux_gnu`
- `//third_party/v8:rusty_v8_sandbox_release_pair_aarch64_unknown_linux_gnu`
- `//third_party/v8:rusty_v8_sandbox_release_pair_x86_64_unknown_linux_musl`
- `//third_party/v8:rusty_v8_sandbox_release_pair_aarch64_unknown_linux_musl`
The Bazel graph pins the same libc++, libc++abi, and llvm-libc source revisions
used by `rusty_v8 v147.4.0`, compiles published artifact targets with
`--config=rusty-v8-upstream-libcxx`, and folds the matching runtime objects into
the final static archive so Cargo consumers can link it with the `v8` crate's
default `use_custom_libcxx` feature. The config keeps the object files and the
bundled runtime on Chromium's `std::__Cr` ABI namespace instead of mixing those
objects with the toolchain libc++ default namespace.
MSVC is not part of the Bazel-produced matrix yet. The repository's current
hermetic Windows C++ platform is `windows-gnullvm`/`x86_64-w64-windows-gnu`, so
it cannot truthfully reproduce upstream's `*-pc-windows-msvc` archives until we
add a real MSVC-targeting C++ toolchain to the Bazel graph.
Cargo musl builds use `RUSTY_V8_ARCHIVE` plus a downloaded
`RUSTY_V8_SRC_BINDING_PATH` to point at those `openai/codex` release assets
directly. We do not use `RUSTY_V8_MIRROR` for musl because the upstream `v8`

157
third_party/v8/libcxx.BUILD.bazel vendored Normal file
View File

@@ -0,0 +1,157 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@llvm//toolchain/runtimes:cc_runtime_library.bzl", "cc_runtime_stage0_library")
package(default_visibility = ["//visibility:public"])
config_setting(
name = "is_linux",
constraint_values = ["@platforms//os:linux"],
)
config_setting(
name = "is_windows",
constraint_values = ["@platforms//os:windows"],
)
LIBCXX_SRCS = [
"src/algorithm.cpp",
"src/any.cpp",
"src/atomic.cpp",
"src/barrier.cpp",
"src/bind.cpp",
"src/call_once.cpp",
"src/charconv.cpp",
"src/chrono.cpp",
"src/condition_variable.cpp",
"src/condition_variable_destructor.cpp",
"src/error_category.cpp",
"src/exception.cpp",
"src/filesystem/directory_iterator.cpp",
"src/filesystem/filesystem_error.cpp",
"src/filesystem/operations.cpp",
"src/filesystem/path.cpp",
"src/functional.cpp",
"src/future.cpp",
"src/hash.cpp",
"src/ios.cpp",
"src/ios.instantiations.cpp",
"src/iostream.cpp",
"src/locale.cpp",
"src/memory.cpp",
"src/mutex.cpp",
"src/mutex_destructor.cpp",
"src/new.cpp",
"src/new_handler.cpp",
"src/new_helpers.cpp",
"src/optional.cpp",
"src/random.cpp",
"src/random_shuffle.cpp",
"src/regex.cpp",
"src/ryu/d2fixed.cpp",
"src/ryu/d2s.cpp",
"src/ryu/f2s.cpp",
"src/shared_mutex.cpp",
"src/stdexcept.cpp",
"src/string.cpp",
"src/strstream.cpp",
"src/system_error.cpp",
"src/thread.cpp",
"src/typeinfo.cpp",
"src/valarray.cpp",
"src/variant.cpp",
"src/vector.cpp",
"src/verbose_abort.cpp",
]
cc_library(
name = "headers",
hdrs = glob(["include/**"]),
strip_include_prefix = "include",
deps = ["@//third_party/v8/libcxx_config:headers"],
)
cc_library(
name = "internal_headers",
hdrs = glob([
"src/**/*.h",
"src/**/*.ipp",
]),
includes = ["src"],
)
cc_runtime_stage0_library(
name = "libcxx",
srcs = LIBCXX_SRCS + select({
":is_linux": [
"src/filesystem/directory_entry.cpp",
"src/filesystem/filesystem_clock.cpp",
],
"//conditions:default": [],
}) + select({
":is_windows": [
"src/support/win32/locale_win32.cpp",
"src/support/win32/support.cpp",
"src/support/win32/thread_win32.cpp",
],
"//conditions:default": [],
}),
copts = [
"-fexceptions",
"-frtti",
"-fstrict-aliasing",
"-fvisibility=hidden",
"-fvisibility-inlines-hidden",
"-nostdinc++",
"-std=c++23",
"-Wno-nullability-completeness",
"-Wno-unused-parameter",
"-Wundef",
] + select({
":is_windows": ["-Wno-macro-redefined"],
"//conditions:default": ["-fPIC"],
}),
defines = [
"CR_LIBCXX_REVISION=7ab65651aed6802d2599dcb7a73b1f82d5179d05",
"LIBCXX_BUILDING_LIBCXXABI",
"LIBC_NAMESPACE=__llvm_libc_cr",
"_LIBCPP_BUILDING_LIBRARY",
"_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
"_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
"_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
] + select({
"@llvm//platforms/config:musl": [
# Chromium's checked-in __config_site uses this switch to enable
# libc++'s musl-specific configuration.
"ANDROID_HOST_MUSL",
],
"//conditions:default": [],
}) + select({
":is_windows": [
"NTDDI_VERSION=NTDDI_WIN7",
"WINVER=_WIN32_WINNT_WIN7",
"_WIN32_WINNT=_WIN32_WINNT_WIN7",
],
"//conditions:default": [],
}),
includes = ["src"],
implementation_deps = [
":headers",
":internal_headers",
"@rusty_v8_libcxxabi//:headers",
"@rusty_v8_llvm_libc//:headers",
] + select({
":is_linux": [
"@@llvm++kernel_headers+kernel_headers//:kernel_headers",
],
"//conditions:default": [],
}) + select({
"@llvm//platforms/config:gnu": [
"@@llvm++glibc+glibc//:gnu_libc_headers",
],
"@llvm//platforms/config:musl": [
"@@llvm++musl+musl_libc//:musl_libc_headers",
],
"//conditions:default": [],
}),
)

View File

@@ -0,0 +1,12 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
package(default_visibility = ["//visibility:public"])
cc_library(
name = "headers",
hdrs = [
"__assertion_handler",
"__config_site",
],
includes = ["."],
)

View File

@@ -0,0 +1,27 @@
// -*- C++ -*-
#ifndef _LIBCPP___ASSERTION_HANDLER
#define _LIBCPP___ASSERTION_HANDLER
#include <__config>
#include <__verbose_abort>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#if defined(OFFICIAL_BUILD) && !defined(DCHECK_ALWAYS_ON)
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __libcpp_hardening_failure() {
__builtin_trap();
}
#define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __libcpp_hardening_failure())
#else
#define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
#endif
#endif // _LIBCPP___ASSERTION_HANDLER

View File

@@ -0,0 +1,55 @@
#ifndef _LIBCPP_CONFIG_SITE
#define _LIBCPP_CONFIG_SITE
#define _LIBCPP_ABI_NAMESPACE __Cr
#define _LIBCPP_ABI_VERSION 2
#define _LIBCPP_ABI_FORCE_ITANIUM 0
#define _LIBCPP_ABI_FORCE_MICROSOFT 0
#define _LIBCPP_HAS_THREADS 1
#define _LIBCPP_HAS_MONOTONIC_CLOCK 1
#define _LIBCPP_HAS_TERMINAL 1
#ifdef ANDROID_HOST_MUSL
#define _LIBCPP_HAS_MUSL_LIBC 1
#else
#define _LIBCPP_HAS_MUSL_LIBC 0
#endif
#ifdef _WIN32
#define _LIBCPP_HAS_THREAD_API_PTHREAD 0
#define _LIBCPP_HAS_THREAD_API_EXTERNAL 0
#define _LIBCPP_HAS_THREAD_API_WIN32 1
#else
#define _LIBCPP_HAS_THREAD_API_PTHREAD 1
#define _LIBCPP_HAS_THREAD_API_EXTERNAL 0
#define _LIBCPP_HAS_THREAD_API_WIN32 0
#endif
#define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
#define _LIBCPP_HAS_FILESYSTEM 1
#define _LIBCPP_HAS_RANDOM_DEVICE 1
#define _LIBCPP_HAS_LOCALIZATION 1
#define _LIBCPP_HAS_UNICODE 1
#define _LIBCPP_HAS_WIDE_CHARACTERS 1
#define _LIBCPP_HAS_TIME_ZONE_DATABASE 1
#if defined(__APPLE__)
#define _LIBCPP_PSTL_BACKEND_LIBDISPATCH
#else
#define _LIBCPP_PSTL_BACKEND_STD_THREAD
#endif
#define _LIBCPP_ASSERTION_SEMANTIC_DEFAULT \
_LIBCPP_ASSERTION_SEMANTIC_HARDENING_DEPENDENT
#define _LIBCPP_LIBC_PICOLIBC 0
#define _LIBCPP_LIBC_NEWLIB 0
#define _LIBCPP_NO_AUTO_LINK
#define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
#define _LIBCPP_NO_ABI_TAG
#define _LIBCPP_VERBOSE_ABORT(...) ::std::__libcpp_verbose_abort(__VA_ARGS__)
#define _LIBCPP_HAS_NO_INCOMPLETE_PSTL
#endif // _LIBCPP_CONFIG_SITE

98
third_party/v8/libcxxabi.BUILD.bazel vendored Normal file
View File

@@ -0,0 +1,98 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@llvm//toolchain/runtimes:cc_runtime_library.bzl", "cc_runtime_stage0_library")
package(default_visibility = ["//visibility:public"])
config_setting(
name = "is_linux",
constraint_values = ["@platforms//os:linux"],
)
config_setting(
name = "is_windows",
constraint_values = ["@platforms//os:windows"],
)
cc_library(
name = "headers",
hdrs = glob(["include/**"]),
strip_include_prefix = "include",
)
cc_runtime_stage0_library(
name = "libcxxabi",
srcs = [
"src/abort_message.cpp",
"src/cxa_aux_runtime.cpp",
"src/cxa_default_handlers.cpp",
"src/cxa_demangle.cpp",
"src/cxa_exception.cpp",
"src/cxa_exception_storage.cpp",
"src/cxa_guard.cpp",
"src/cxa_handlers.cpp",
"src/cxa_personality.cpp",
"src/cxa_vector.cpp",
"src/cxa_virtual.cpp",
"src/fallback_malloc.cpp",
"src/private_typeinfo.cpp",
"src/stdlib_exception.cpp",
"src/stdlib_stdexcept.cpp",
"src/stdlib_typeinfo.cpp",
] + select({
":is_linux": ["src/cxa_thread_atexit.cpp"],
"//conditions:default": [],
}),
textual_hdrs = glob([
"src/**/*.def",
"src/**/*.h",
"src/**/*.inc",
]),
copts = [
"-fexceptions",
"-frtti",
"-fstrict-aliasing",
"-fvisibility=hidden",
"-fvisibility-inlines-hidden",
"-nostdinc++",
"-std=c++23",
"-Wno-nullability-completeness",
"-Wno-unused-parameter",
"-Wundef",
] + select({
":is_windows": ["-Wno-macro-redefined"],
"//conditions:default": ["-fPIC"],
}),
defines = [
"LIBCXXABI_SILENT_TERMINATE",
"_LIBCPP_BUILDING_LIBRARY",
"_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
"_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
"_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
] + select({
"@llvm//platforms/config:musl": [
"ANDROID_HOST_MUSL",
],
"//conditions:default": [],
}),
includes = ["src"],
implementation_deps = [
":headers",
"@rusty_v8_libcxx//:headers",
"@rusty_v8_libcxx//:internal_headers",
"@//third_party/v8/libcxx_config:headers",
] + select({
":is_linux": [
"@@llvm++kernel_headers+kernel_headers//:kernel_headers",
],
"//conditions:default": [],
}) + select({
"@llvm//platforms/config:gnu": [
"@@llvm++glibc+glibc//:gnu_libc_headers",
],
"@llvm//platforms/config:musl": [
"@@llvm++musl+musl_libc//:musl_libc_headers",
],
"//conditions:default": [],
}),
)

10
third_party/v8/llvm_libc.BUILD.bazel vendored Normal file
View File

@@ -0,0 +1,10 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
package(default_visibility = ["//visibility:public"])
cc_library(
name = "headers",
hdrs = glob(["**/*.h"]),
defines = ["LIBC_NAMESPACE=__llvm_libc_cr"],
includes = ["."],
)

View File

@@ -1,10 +0,0 @@
bfe2c9be32a56c28546f0f965825ee68fbf606405f310cc4e17b448a568cf98a librusty_v8_release_aarch64-apple-darwin.a.gz
dbf165b07c81bdb054bc046b43d23e69fcf7bcc1a4c1b5b4776983a71062ecd8 librusty_v8_release_aarch64-unknown-linux-gnu.a.gz
ed13363659c6d08583ac8fdc40493445c5767d8b94955a4d5d7bb8d5a81f6bf8 rusty_v8_release_aarch64-pc-windows-msvc.lib.gz
630cd240f1bbecdb071417dc18387ab81cf67c549c1c515a0b4fcf9eba647bb7 librusty_v8_release_x86_64-apple-darwin.a.gz
e64b4d99e4ae293a2e846244a89b80178ba10382c13fb591c1fa6968f5291153 librusty_v8_release_x86_64-unknown-linux-gnu.a.gz
90a9a2346acd3685a355e98df85c24dbe406cb124367d16259a4b5d522621862 rusty_v8_release_x86_64-pc-windows-msvc.lib.gz
27a08ed26c34297bfd93e514692ccc44b85f8b15c6aa39cf34e784f84fb37e8e librusty_v8_release_aarch64-unknown-linux-musl.a.gz
09f8900ced8297c229246c7a50b2e0ec23c54d0a554f369619cc29863f38dd1a src_binding_release_aarch64-unknown-linux-musl.rs
20d8271ad712323d352c1383c36e3c4b755abc41ece35819c49c75ec7134d2f8 librusty_v8_release_x86_64-unknown-linux-musl.a.gz
09f8900ced8297c229246c7a50b2e0ec23c54d0a554f369619cc29863f38dd1a src_binding_release_x86_64-unknown-linux-musl.rs

View File

@@ -0,0 +1,2 @@
1fa3f94d9e09cff1f6bcce94c478e5cb072c0755f6a0357abadb9dd3b48d8127 rusty_v8_release_aarch64-pc-windows-msvc.lib.gz
e2827ff98b1a9d4c0343000fc5124ac30dfab3007bc0129c168c9355fc2fcd7c rusty_v8_release_x86_64-pc-windows-msvc.lib.gz

View File

@@ -5,6 +5,11 @@ filegroup(
srcs = ["src/binding.cc"],
)
filegroup(
name = "crdtp_binding_cc",
srcs = ["src/crdtp_binding.cc"],
)
filegroup(
name = "support_h",
srcs = ["src/support.h"],