mirror of
https://github.com/openai/codex.git
synced 2026-10-27 18:48:37 +00:00
Enforce V8 artifact profiles at Bazel target boundaries (#57165)
## Why V8 source and release artifacts require different ABI and C++ runtime settings. Selecting a named artifact should also select its required settings, without callers coordinating separate sandbox, pointer compression, libc++, and CPU flags. ## What changed - Add Bazel transitions for `source`, `release`, and `sandbox_release` profiles. Source builds use the sandbox ABI and workspace runtime; release pairs use Chromium's pinned runtime with their respective ABI. - Select the V8 CPU from the artifact target and enforce matching target platform constraints. - Make the underlying V8 settings unavailable as CLI flags and remove redundant configuration from release tooling and workflows. - Select Darwin/Linux prebuilts solely through `rusty_v8_from_source`, keeping source archives and bindings paired when enabled. GitOrigin-RevId: f72fc06b6f74b79ab2ab8ca697e4f2006076a833
This commit is contained in:
@@ -216,23 +216,6 @@ common:ci-v8 --config=ci
|
||||
common:ci-v8 --build_metadata=TAG_workflow=v8
|
||||
common:ci-v8 --build_metadata=TAG_os=linux
|
||||
|
||||
# Source-built Bazel V8 artifacts use the in-process sandbox by default. This
|
||||
# does not affect Cargo's default prebuilt rusty_v8 path.
|
||||
common --@v8//:v8_enable_pointer_compression=True
|
||||
common --@v8//:v8_enable_sandbox=True
|
||||
|
||||
# Keep currently published rusty_v8 release artifacts non-sandboxed until the
|
||||
# artifact migration ships matching Rust feature selection for Cargo consumers.
|
||||
common:v8-release-compat --@v8//:v8_enable_pointer_compression=False
|
||||
common:v8-release-compat --@v8//:v8_enable_sandbox=False
|
||||
common:v8-target-x64 --@v8//bazel/config:v8_target_cpu=x64
|
||||
common:v8-target-arm64 --@v8//bazel/config:v8_target_cpu=arm64
|
||||
|
||||
# Match rusty_v8's upstream GN release contract for published artifacts: every
|
||||
# target object uses Chromium's custom libc++ headers and the archive folds in
|
||||
# the matching runtime objects.
|
||||
common:rusty-v8-upstream-libcxx --@v8//:v8_use_rusty_v8_custom_libcxx=True
|
||||
|
||||
# Native Windows MSVC builds inherit the runner's MSVC SDK environment.
|
||||
# Client environment capture and repository discovery happen before target
|
||||
# transitions, so these runner settings cannot live in runtime_package.bzl.
|
||||
|
||||
@@ -26,7 +26,6 @@ MODULE_BAZEL = ROOT / "MODULE.bazel"
|
||||
RUSTY_V8_CHECKSUMS_DIR = ROOT / "third_party" / "v8"
|
||||
RELEASE_ARTIFACT_PROFILE = "release"
|
||||
SANDBOX_ARTIFACT_PROFILE = "ptrcomp_sandbox_release"
|
||||
ARTIFACT_BAZEL_CONFIGS = ["rusty-v8-upstream-libcxx"]
|
||||
|
||||
|
||||
def bazel_execroot() -> Path:
|
||||
@@ -125,14 +124,6 @@ def ensure_bazel_output_files(
|
||||
return outputs
|
||||
|
||||
|
||||
def artifact_bazel_configs(bazel_configs: list[str] | None = None) -> list[str]:
|
||||
configured = list(ARTIFACT_BAZEL_CONFIGS)
|
||||
for config in bazel_configs or []:
|
||||
if config not in configured:
|
||||
configured.append(config)
|
||||
return configured
|
||||
|
||||
|
||||
def release_pair_label(target: str, sandbox: bool = False) -> str:
|
||||
target_suffix = target.replace("-", "_")
|
||||
pair_kind = "sandbox_release_pair" if sandbox else "release_pair"
|
||||
@@ -290,7 +281,6 @@ def stage_release_pair(
|
||||
bazel_configs: list[str] | None = None,
|
||||
sandbox: bool = False,
|
||||
) -> None:
|
||||
bazel_configs = artifact_bazel_configs(bazel_configs)
|
||||
outputs = ensure_bazel_output_files(
|
||||
platform,
|
||||
[release_pair_label(target, sandbox)],
|
||||
|
||||
@@ -25,7 +25,7 @@ class RustyV8BazelTest(unittest.TestCase):
|
||||
"aarch64_pc_windows_gnullvm",
|
||||
"aarch64_pc_windows_msvc",
|
||||
"aarch64_unknown_linux_gnu_bazel",
|
||||
"aarch64_unknown_linux_musl_release_base",
|
||||
"aarch64_unknown_linux_musl_release",
|
||||
"x86_64_apple_darwin_bazel",
|
||||
"x86_64_pc_windows_gnullvm",
|
||||
"x86_64_pc_windows_msvc",
|
||||
@@ -72,22 +72,6 @@ class RustyV8BazelTest(unittest.TestCase):
|
||||
with patch.object(rusty_v8_bazel, "MODULE_BAZEL", module_bazel):
|
||||
self.assertEqual("146.4.0", rusty_v8_bazel.command_version(None))
|
||||
|
||||
def test_artifact_bazel_configs_always_enable_upstream_libcxx(self) -> None:
|
||||
self.assertEqual(
|
||||
["rusty-v8-upstream-libcxx"],
|
||||
rusty_v8_bazel.artifact_bazel_configs(),
|
||||
)
|
||||
self.assertEqual(
|
||||
["rusty-v8-upstream-libcxx", "v8-release-compat"],
|
||||
rusty_v8_bazel.artifact_bazel_configs(["v8-release-compat"]),
|
||||
)
|
||||
self.assertEqual(
|
||||
["rusty-v8-upstream-libcxx", "v8-release-compat"],
|
||||
rusty_v8_bazel.artifact_bazel_configs(
|
||||
["rusty-v8-upstream-libcxx", "v8-release-compat"]
|
||||
),
|
||||
)
|
||||
|
||||
def test_bazel_commands_use_shared_buildbuddy_remote_config_library(self) -> None:
|
||||
with patch.dict(environ, {}, clear=True):
|
||||
self.assertEqual(
|
||||
@@ -276,7 +260,7 @@ class RustyV8BazelTest(unittest.TestCase):
|
||||
"macos_arm64",
|
||||
["//third_party/v8:pair"],
|
||||
"opt",
|
||||
["rusty-v8-upstream-libcxx"],
|
||||
["ci-macos"],
|
||||
),
|
||||
)
|
||||
|
||||
@@ -284,14 +268,14 @@ class RustyV8BazelTest(unittest.TestCase):
|
||||
"macos_arm64",
|
||||
["//third_party/v8:pair"],
|
||||
"opt",
|
||||
["rusty-v8-upstream-libcxx"],
|
||||
["ci-macos"],
|
||||
download_toplevel=True,
|
||||
)
|
||||
bazel_output_files.assert_called_once_with(
|
||||
"macos_arm64",
|
||||
["//third_party/v8:pair"],
|
||||
"opt",
|
||||
["rusty-v8-upstream-libcxx"],
|
||||
["ci-macos"],
|
||||
)
|
||||
|
||||
def test_update_module_bazel_replaces_and_inserts_sha256(self) -> None:
|
||||
|
||||
@@ -76,84 +76,72 @@ jobs:
|
||||
platform: linux_amd64
|
||||
sandbox: false
|
||||
target: x86_64-unknown-linux-gnu
|
||||
v8_cpu: x64
|
||||
variant: release
|
||||
- runner: ubuntu-24.04
|
||||
bazel_config: ci-v8
|
||||
platform: linux_amd64
|
||||
sandbox: true
|
||||
target: x86_64-unknown-linux-gnu
|
||||
v8_cpu: x64
|
||||
variant: ptrcomp-sandbox
|
||||
- runner: ubuntu-24.04-arm
|
||||
bazel_config: ci-v8
|
||||
platform: linux_arm64
|
||||
sandbox: false
|
||||
target: aarch64-unknown-linux-gnu
|
||||
v8_cpu: arm64
|
||||
variant: release
|
||||
- runner: ubuntu-24.04-arm
|
||||
bazel_config: ci-v8
|
||||
platform: linux_arm64
|
||||
sandbox: true
|
||||
target: aarch64-unknown-linux-gnu
|
||||
v8_cpu: arm64
|
||||
variant: ptrcomp-sandbox
|
||||
- runner: macos-15-xlarge
|
||||
bazel_config: ci-macos
|
||||
platform: macos_amd64
|
||||
sandbox: false
|
||||
target: x86_64-apple-darwin
|
||||
v8_cpu: x64
|
||||
variant: release
|
||||
- runner: macos-15-xlarge
|
||||
bazel_config: ci-macos
|
||||
platform: macos_amd64
|
||||
sandbox: true
|
||||
target: x86_64-apple-darwin
|
||||
v8_cpu: x64
|
||||
variant: ptrcomp-sandbox
|
||||
- runner: macos-15-xlarge
|
||||
bazel_config: ci-macos
|
||||
platform: macos_arm64
|
||||
sandbox: false
|
||||
target: aarch64-apple-darwin
|
||||
v8_cpu: arm64
|
||||
variant: release
|
||||
- runner: macos-15-xlarge
|
||||
bazel_config: ci-macos
|
||||
platform: macos_arm64
|
||||
sandbox: true
|
||||
target: aarch64-apple-darwin
|
||||
v8_cpu: arm64
|
||||
variant: ptrcomp-sandbox
|
||||
- runner: ubuntu-24.04
|
||||
bazel_config: ci-v8
|
||||
platform: linux_amd64_musl
|
||||
sandbox: false
|
||||
target: x86_64-unknown-linux-musl
|
||||
v8_cpu: x64
|
||||
variant: release
|
||||
- runner: ubuntu-24.04-arm
|
||||
bazel_config: ci-v8
|
||||
platform: linux_arm64_musl
|
||||
sandbox: false
|
||||
target: aarch64-unknown-linux-musl
|
||||
v8_cpu: arm64
|
||||
variant: release
|
||||
- runner: ubuntu-24.04
|
||||
bazel_config: ci-v8
|
||||
platform: linux_amd64_musl
|
||||
sandbox: true
|
||||
target: x86_64-unknown-linux-musl
|
||||
v8_cpu: x64
|
||||
variant: ptrcomp-sandbox
|
||||
- runner: ubuntu-24.04-arm
|
||||
bazel_config: ci-v8
|
||||
platform: linux_arm64_musl
|
||||
sandbox: true
|
||||
target: aarch64-unknown-linux-musl
|
||||
v8_cpu: arm64
|
||||
variant: ptrcomp-sandbox
|
||||
|
||||
steps:
|
||||
@@ -183,7 +171,6 @@ jobs:
|
||||
PLATFORM: ${{ matrix.platform }}
|
||||
SANDBOX: ${{ matrix.sandbox }}
|
||||
TARGET: ${{ matrix.target }}
|
||||
V8_CPU: ${{ matrix.v8_cpu }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -200,14 +187,9 @@ jobs:
|
||||
-c
|
||||
opt
|
||||
"--platforms=@llvm//platforms:${PLATFORM}"
|
||||
--config=rusty-v8-upstream-libcxx
|
||||
"--config=v8-target-${V8_CPU}"
|
||||
"${pair_target}"
|
||||
--build_metadata=COMMIT_SHA=$(git rev-parse HEAD)
|
||||
)
|
||||
if [[ "${SANDBOX}" != "true" ]]; then
|
||||
bazel_args+=(--config=v8-release-compat)
|
||||
fi
|
||||
|
||||
./.github/scripts/run_bazel_with_buildbuddy.py \
|
||||
--noexperimental_remote_repo_contents_cache \
|
||||
@@ -221,7 +203,6 @@ jobs:
|
||||
PLATFORM: ${{ matrix.platform }}
|
||||
SANDBOX: ${{ matrix.sandbox }}
|
||||
TARGET: ${{ matrix.target }}
|
||||
V8_CPU: ${{ matrix.v8_cpu }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -232,12 +213,9 @@ jobs:
|
||||
--compilation-mode opt
|
||||
--output-dir "dist/${TARGET}"
|
||||
--bazel-config "${BAZEL_CONFIG}"
|
||||
--bazel-config "v8-target-${V8_CPU}"
|
||||
)
|
||||
if [[ "${SANDBOX}" == "true" ]]; then
|
||||
stage_args+=(--sandbox)
|
||||
else
|
||||
stage_args+=(--bazel-config v8-release-compat)
|
||||
fi
|
||||
|
||||
python3 .github/scripts/rusty_v8_bazel.py stage-release-pair "${stage_args[@]}"
|
||||
|
||||
@@ -90,84 +90,72 @@ jobs:
|
||||
platform: linux_amd64
|
||||
sandbox: false
|
||||
target: x86_64-unknown-linux-gnu
|
||||
v8_cpu: x64
|
||||
variant: release
|
||||
- runner: ubuntu-24.04
|
||||
bazel_config: ci-v8
|
||||
platform: linux_amd64
|
||||
sandbox: true
|
||||
target: x86_64-unknown-linux-gnu
|
||||
v8_cpu: x64
|
||||
variant: ptrcomp-sandbox
|
||||
- runner: ubuntu-24.04-arm
|
||||
bazel_config: ci-v8
|
||||
platform: linux_arm64
|
||||
sandbox: false
|
||||
target: aarch64-unknown-linux-gnu
|
||||
v8_cpu: arm64
|
||||
variant: release
|
||||
- runner: ubuntu-24.04-arm
|
||||
bazel_config: ci-v8
|
||||
platform: linux_arm64
|
||||
sandbox: true
|
||||
target: aarch64-unknown-linux-gnu
|
||||
v8_cpu: arm64
|
||||
variant: ptrcomp-sandbox
|
||||
- runner: macos-15-xlarge
|
||||
bazel_config: ci-macos
|
||||
platform: macos_amd64
|
||||
sandbox: false
|
||||
target: x86_64-apple-darwin
|
||||
v8_cpu: x64
|
||||
variant: release
|
||||
- runner: macos-15-xlarge
|
||||
bazel_config: ci-macos
|
||||
platform: macos_amd64
|
||||
sandbox: true
|
||||
target: x86_64-apple-darwin
|
||||
v8_cpu: x64
|
||||
variant: ptrcomp-sandbox
|
||||
- runner: macos-15-xlarge
|
||||
bazel_config: ci-macos
|
||||
platform: macos_arm64
|
||||
sandbox: false
|
||||
target: aarch64-apple-darwin
|
||||
v8_cpu: arm64
|
||||
variant: release
|
||||
- runner: macos-15-xlarge
|
||||
bazel_config: ci-macos
|
||||
platform: macos_arm64
|
||||
sandbox: true
|
||||
target: aarch64-apple-darwin
|
||||
v8_cpu: arm64
|
||||
variant: ptrcomp-sandbox
|
||||
- runner: ubuntu-24.04
|
||||
bazel_config: ci-v8
|
||||
platform: linux_amd64_musl
|
||||
sandbox: false
|
||||
target: x86_64-unknown-linux-musl
|
||||
v8_cpu: x64
|
||||
variant: release
|
||||
- runner: ubuntu-24.04
|
||||
bazel_config: ci-v8
|
||||
platform: linux_amd64_musl
|
||||
sandbox: true
|
||||
target: x86_64-unknown-linux-musl
|
||||
v8_cpu: x64
|
||||
variant: ptrcomp-sandbox
|
||||
- runner: ubuntu-24.04-arm
|
||||
bazel_config: ci-v8
|
||||
platform: linux_arm64_musl
|
||||
sandbox: false
|
||||
target: aarch64-unknown-linux-musl
|
||||
v8_cpu: arm64
|
||||
variant: release
|
||||
- runner: ubuntu-24.04-arm
|
||||
bazel_config: ci-v8
|
||||
platform: linux_arm64_musl
|
||||
sandbox: true
|
||||
target: aarch64-unknown-linux-musl
|
||||
v8_cpu: arm64
|
||||
variant: ptrcomp-sandbox
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
@@ -196,7 +184,6 @@ jobs:
|
||||
PLATFORM: ${{ matrix.platform }}
|
||||
SANDBOX: ${{ matrix.sandbox }}
|
||||
TARGET: ${{ matrix.target }}
|
||||
V8_CPU: ${{ matrix.v8_cpu }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -211,14 +198,9 @@ jobs:
|
||||
bazel_args=(
|
||||
build
|
||||
"--platforms=@llvm//platforms:${PLATFORM}"
|
||||
--config=rusty-v8-upstream-libcxx
|
||||
"--config=v8-target-${V8_CPU}"
|
||||
"${pair_target}"
|
||||
--build_metadata=COMMIT_SHA=$(git rev-parse HEAD)
|
||||
)
|
||||
if [[ "${SANDBOX}" != "true" ]]; then
|
||||
bazel_args+=(--config=v8-release-compat)
|
||||
fi
|
||||
|
||||
./.github/scripts/run_bazel_with_buildbuddy.py \
|
||||
--noexperimental_remote_repo_contents_cache \
|
||||
@@ -232,7 +214,6 @@ jobs:
|
||||
PLATFORM: ${{ matrix.platform }}
|
||||
SANDBOX: ${{ matrix.sandbox }}
|
||||
TARGET: ${{ matrix.target }}
|
||||
V8_CPU: ${{ matrix.v8_cpu }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -242,12 +223,9 @@ jobs:
|
||||
--target "${TARGET}"
|
||||
--output-dir "dist/${TARGET}"
|
||||
--bazel-config "${BAZEL_CONFIG}"
|
||||
--bazel-config "v8-target-${V8_CPU}"
|
||||
)
|
||||
if [[ "${SANDBOX}" == "true" ]]; then
|
||||
stage_args+=(--sandbox)
|
||||
else
|
||||
stage_args+=(--bazel-config v8-release-compat)
|
||||
fi
|
||||
|
||||
python3 .github/scripts/rusty_v8_bazel.py stage-release-pair "${stage_args[@]}"
|
||||
|
||||
Vendored
+95
-41
@@ -1,3 +1,4 @@
|
||||
load("@@//third_party/v8:artifact_profile.bzl", "v8_artifact_files")
|
||||
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
|
||||
load("@rules_cc//cc:cc_static_library.bzl", "cc_static_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
@@ -7,6 +8,7 @@ package(default_visibility = ["//visibility:public"])
|
||||
exports_files([
|
||||
"abseil.BUILD.bazel",
|
||||
"abseil_repository.bzl",
|
||||
"artifact_profile.bzl",
|
||||
"dependencies.bzl",
|
||||
"dependency_config.bzl",
|
||||
"dragonbox.BUILD.bazel",
|
||||
@@ -83,16 +85,13 @@ alias(
|
||||
actual = ":src_binding_release_aarch64_unknown_linux_gnu_152_2_0_release",
|
||||
)
|
||||
|
||||
# Published files contain both pointer compression and the in-process sandbox.
|
||||
# Use the source pair together whenever those options differ or a caller needs
|
||||
# custom V8 C++ flags. The main-repo flag is shared with the @v8_targets copy
|
||||
# of this BUILD file used by rules_rs.
|
||||
# Both ordinary consumers and source consumers use the current sandbox ABI.
|
||||
# Switch the archive and binding together for source instrumentation. The same
|
||||
# root setting is visible in the @v8_targets copy used by rules_rs.
|
||||
config_setting(
|
||||
name = "use_rusty_v8_prebuilts",
|
||||
flag_values = {
|
||||
"@//:rusty_v8_from_source": "False",
|
||||
"@v8//:v8_enable_pointer_compression": "True",
|
||||
"@v8//:v8_enable_sandbox": "True",
|
||||
},
|
||||
)
|
||||
|
||||
@@ -315,8 +314,9 @@ cc_library(
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "v8_152_2_0_aarch64_apple_darwin_bazel",
|
||||
name = "_v8_152_2_0_aarch64_apple_darwin_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
@@ -324,8 +324,9 @@ cc_static_library(
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "v8_152_2_0_aarch64_unknown_linux_gnu_bazel",
|
||||
name = "_v8_152_2_0_aarch64_unknown_linux_gnu_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
@@ -333,14 +334,16 @@ cc_static_library(
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "v8_152_2_0_aarch64_pc_windows_gnullvm_bazel",
|
||||
name = "_v8_152_2_0_aarch64_pc_windows_gnullvm_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [":v8_152_2_0_binding"],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "v8_152_2_0_aarch64_unknown_linux_musl_release_base",
|
||||
name = "_v8_152_2_0_aarch64_unknown_linux_musl_release_base",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
@@ -348,16 +351,16 @@ cc_static_library(
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "v8_152_2_0_aarch64_unknown_linux_musl_release",
|
||||
name = "_v8_152_2_0_aarch64_unknown_linux_musl_release",
|
||||
srcs = [
|
||||
":v8_152_2_0_aarch64_unknown_linux_musl_release_base",
|
||||
":_v8_152_2_0_aarch64_unknown_linux_musl_release_base",
|
||||
"@llvm//runtimes/compiler-rt:clang_rt.builtins.static",
|
||||
],
|
||||
outs = ["libv8_152_2_0_aarch64_unknown_linux_musl.a"],
|
||||
cmd = """
|
||||
cat > "$(@D)/merge.mri" <<'EOF'
|
||||
create $@
|
||||
addlib $(location :v8_152_2_0_aarch64_unknown_linux_musl_release_base)
|
||||
addlib $(location :_v8_152_2_0_aarch64_unknown_linux_musl_release_base)
|
||||
addlib $(location @llvm//runtimes/compiler-rt:clang_rt.builtins.static)
|
||||
save
|
||||
end
|
||||
@@ -369,11 +372,13 @@ EOF
|
||||
"@llvm//tools:llvm-ar",
|
||||
"@llvm//tools:llvm-ranlib",
|
||||
],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "v8_152_2_0_x86_64_apple_darwin_bazel",
|
||||
name = "_v8_152_2_0_x86_64_apple_darwin_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
@@ -381,8 +386,9 @@ cc_static_library(
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "v8_152_2_0_x86_64_unknown_linux_gnu_bazel",
|
||||
name = "_v8_152_2_0_x86_64_unknown_linux_gnu_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
@@ -390,20 +396,44 @@ cc_static_library(
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "v8_152_2_0_x86_64_pc_windows_gnullvm_bazel",
|
||||
name = "_v8_152_2_0_x86_64_pc_windows_gnullvm_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [":v8_152_2_0_binding"],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "v8_152_2_0_x86_64_unknown_linux_musl_release",
|
||||
name = "_v8_152_2_0_x86_64_unknown_linux_musl_release",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
],
|
||||
)
|
||||
|
||||
# Local source producers match the Rust consumer's sandbox ABI, and use the
|
||||
# workspace C++ runtime. Release pairs below select pinned Chromium libc++ and
|
||||
# build the private source nodes directly under their own profiles.
|
||||
[
|
||||
v8_artifact_files(
|
||||
name = name,
|
||||
srcs = [":_" + name],
|
||||
profile = "source",
|
||||
v8_cpu = cpu,
|
||||
)
|
||||
for name, cpu in [
|
||||
("v8_152_2_0_aarch64_apple_darwin_bazel", "arm64"),
|
||||
("v8_152_2_0_aarch64_unknown_linux_gnu_bazel", "arm64"),
|
||||
("v8_152_2_0_aarch64_pc_windows_gnullvm_bazel", "arm64"),
|
||||
("v8_152_2_0_aarch64_unknown_linux_musl_release", "arm64"),
|
||||
("v8_152_2_0_x86_64_apple_darwin_bazel", "x64"),
|
||||
("v8_152_2_0_x86_64_unknown_linux_gnu_bazel", "x64"),
|
||||
("v8_152_2_0_x86_64_pc_windows_gnullvm_bazel", "x64"),
|
||||
("v8_152_2_0_x86_64_unknown_linux_musl_release", "x64"),
|
||||
]
|
||||
]
|
||||
|
||||
filegroup(
|
||||
name = "src_binding_release_aarch64_apple_darwin_152_2_0_release",
|
||||
srcs = ["@v8_crate_152_2_0//:src_binding_release_aarch64_apple_darwin"],
|
||||
@@ -444,52 +474,64 @@ alias(
|
||||
actual = "@rusty_v8_152_2_0_x86_64_pc_windows_msvc_binding//file",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_x86_64_apple_darwin",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_apple_darwin_bazel",
|
||||
":src_binding_release_x86_64_apple_darwin_152_2_0_release",
|
||||
":v8_152_2_0_x86_64_apple_darwin_bazel",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_aarch64_apple_darwin",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_apple_darwin_bazel",
|
||||
":src_binding_release_aarch64_apple_darwin_152_2_0_release",
|
||||
":v8_152_2_0_aarch64_apple_darwin_bazel",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_x86_64_unknown_linux_gnu",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_unknown_linux_gnu_bazel",
|
||||
":src_binding_release_x86_64_unknown_linux_gnu_152_2_0_release",
|
||||
":v8_152_2_0_x86_64_unknown_linux_gnu_bazel",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_aarch64_unknown_linux_gnu",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_unknown_linux_gnu_bazel",
|
||||
":src_binding_release_aarch64_unknown_linux_gnu_152_2_0_release",
|
||||
":v8_152_2_0_aarch64_unknown_linux_gnu_bazel",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_x86_64_unknown_linux_musl",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_unknown_linux_musl_release",
|
||||
":src_binding_release_x86_64_unknown_linux_musl_152_2_0_release",
|
||||
":v8_152_2_0_x86_64_unknown_linux_musl_release",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_aarch64_unknown_linux_musl",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_unknown_linux_musl_release",
|
||||
":src_binding_release_aarch64_unknown_linux_musl_152_2_0_release",
|
||||
":v8_152_2_0_aarch64_unknown_linux_musl_release",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
@@ -508,50 +550,62 @@ filegroup(
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_x86_64_apple_darwin",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_apple_darwin_bazel",
|
||||
":src_binding_release_x86_64_apple_darwin_152_2_0_release",
|
||||
":v8_152_2_0_x86_64_apple_darwin_bazel",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_aarch64_apple_darwin",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_apple_darwin_bazel",
|
||||
":src_binding_release_aarch64_apple_darwin_152_2_0_release",
|
||||
":v8_152_2_0_aarch64_apple_darwin_bazel",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_x86_64_unknown_linux_gnu",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_unknown_linux_gnu_bazel",
|
||||
":src_binding_release_x86_64_unknown_linux_gnu_152_2_0_release",
|
||||
":v8_152_2_0_x86_64_unknown_linux_gnu_bazel",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_aarch64_unknown_linux_gnu",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_unknown_linux_gnu_bazel",
|
||||
":src_binding_release_aarch64_unknown_linux_gnu_152_2_0_release",
|
||||
":v8_152_2_0_aarch64_unknown_linux_gnu_bazel",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_x86_64_unknown_linux_musl",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_unknown_linux_musl_release",
|
||||
":src_binding_release_x86_64_unknown_linux_musl_152_2_0_release",
|
||||
":v8_152_2_0_x86_64_unknown_linux_musl_release",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_aarch64_unknown_linux_musl",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_unknown_linux_musl_release",
|
||||
":src_binding_release_aarch64_unknown_linux_musl_152_2_0_release",
|
||||
":v8_152_2_0_aarch64_unknown_linux_musl_release",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
Vendored
+19
-15
@@ -16,11 +16,13 @@ for its consumers. All Bazel compilation modes use the same published V8
|
||||
release archive on supported platforms.
|
||||
|
||||
The Bazel `v8` crate feature selection enables V8's in-process sandbox.
|
||||
Darwin/Linux consumers select prebuilts only when both the V8 sandbox and pointer
|
||||
compression settings match the published artifact. For source instrumentation
|
||||
or custom V8 C++ settings, use `--//:rusty_v8_from_source=true`; the archive
|
||||
and binding then both come from the source path. The published release archive
|
||||
cannot incorporate local V8 C++ flags or native debug/sanitizer settings.
|
||||
Darwin/Linux consumers use the matching published pair by default.
|
||||
For a source build use `--//:rusty_v8_from_source=true`; both archive and
|
||||
bindings then come from the source path. Source targets enforce the workspace
|
||||
runtime and sandbox/pointer-compression ABI. Release-pair targets enforce either
|
||||
the legacy or the sandbox ABI plus Chromium's pinned runtime. Target CPU follows
|
||||
the named artifact. The underlying V8 settings are internal, and callers do
|
||||
not pass separate V8 feature or libc++ flags.
|
||||
|
||||
Current pinned versions:
|
||||
|
||||
@@ -110,10 +112,10 @@ from upstream `rusty_v8` source. Those ABI-specific outputs cannot be produced
|
||||
by Codex's Bazel Windows GNU toolchain.
|
||||
|
||||
The Bazel graph pins the same libc++, libc++abi, and llvm-libc source revisions
|
||||
used by `rusty_v8 v152.2.0`, compiles published artifact targets with
|
||||
`--config=rusty-v8-upstream-libcxx`, and folds the matching runtime objects into
|
||||
the final static archive so consumers can link it with the `v8` crate's default
|
||||
`use_custom_libcxx` feature. The config keeps the object files and the bundled
|
||||
used by `rusty_v8 v152.2.0`. The named release and sandbox-release pair targets
|
||||
select those headers and fold the matching runtime objects into the final static
|
||||
archive so consumers can link it with the `v8` crate's default
|
||||
`use_custom_libcxx` feature. The profile 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. Bazel consumers use these
|
||||
published archives for supported Darwin/Linux platforms, as do Cargo release and
|
||||
@@ -157,14 +159,16 @@ each fetch, including added, removed or reordered groups. The importer rejects
|
||||
missing boundaries, malformed or empty sections, and new compiled targets. Only
|
||||
the two known Dragonbox and FP16 declarations are skipped, since the dependency
|
||||
overlays already supply them. `v8_binary` is valid V8 syntax, but compiled targets
|
||||
must be reviewed against the owned engine BUILD on an upgrade. The
|
||||
upstream `bazel/config` platform and CPU package is reused unchanged.
|
||||
`v8_defs.patch` records just the Codex differences to upstream's
|
||||
`bazel/defs.bzl`: release flag visibility, libc++ headers/runtime, Windows
|
||||
must be reviewed against the owned engine BUILD on an upgrade.
|
||||
The upstream `bazel/config` platform and CPU package is reused; only the CPU
|
||||
setting changes from a CLI flag to an internal setting. `v8_defs.patch` records
|
||||
that change and the Codex differences to upstream's `bazel/defs.bzl`:
|
||||
internal ABI/runtime settings, their visibility, libc++ headers/runtime, Windows
|
||||
compiler and linker settings, and snapshot generation. All engine rules,
|
||||
including Torque and V8's test configuration helpers, load from that file.
|
||||
The engine BUILD owns feature policy and dependency targets; the remaining V8
|
||||
ABI, runtime and CPU settings still support the existing release commands.
|
||||
The engine BUILD owns feature policy and dependency targets. ABI, runtime and
|
||||
CPU settings are selected together by `artifact_profile.bzl` for source and
|
||||
release-pair targets.
|
||||
|
||||
V8's private Abseil is built from the pinned 20250814.1 sources and uses
|
||||
`codex_v8_lts_20250814` for its supported inline-namespace option. Protobuf
|
||||
|
||||
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
"""Complete V8 artifact profiles, enforced at the source archive boundary.
|
||||
|
||||
The source profile is for local consumers and uses the workspace C++ runtime.
|
||||
Published profiles embed the pinned Chromium runtime. Generators inherit the
|
||||
V8 target CPU even when their executable is built for the exec platform.
|
||||
"""
|
||||
|
||||
_POINTER_COMPRESSION = "@v8//:v8_enable_pointer_compression"
|
||||
_SANDBOX = "@v8//:v8_enable_sandbox"
|
||||
_LIBCXX = "@v8//:v8_use_rusty_v8_custom_libcxx"
|
||||
_TARGET_CPU = "@v8//bazel/config:v8_target_cpu"
|
||||
_CPU_CONSTRAINTS = {
|
||||
"arm64": Label("@platforms//cpu:aarch64"),
|
||||
"x64": Label("@platforms//cpu:x86_64"),
|
||||
}
|
||||
|
||||
def _artifact_profile_impl(_settings, attr):
|
||||
sandbox = attr.profile != "release"
|
||||
return {
|
||||
_POINTER_COMPRESSION: "True" if sandbox else "False",
|
||||
_SANDBOX: sandbox,
|
||||
_LIBCXX: attr.profile != "source",
|
||||
_TARGET_CPU: attr.v8_cpu,
|
||||
}
|
||||
|
||||
_artifact_profile = transition(
|
||||
implementation = _artifact_profile_impl,
|
||||
inputs = [],
|
||||
outputs = [_POINTER_COMPRESSION, _SANDBOX, _LIBCXX, _TARGET_CPU],
|
||||
)
|
||||
|
||||
def _profiled_files_impl(ctx):
|
||||
constraint_target = ctx.attr._arm64 if ctx.attr.v8_cpu == "arm64" else ctx.attr._x64
|
||||
if not ctx.target_platform_has_constraint(constraint_target[platform_common.ConstraintValueInfo]):
|
||||
fail("%s: V8 CPU %s requires %s on the Bazel target platform. Choose a matching artifact target and --platforms." % (
|
||||
ctx.label,
|
||||
ctx.attr.v8_cpu,
|
||||
constraint_target.label,
|
||||
))
|
||||
files = depset(transitive = [target[DefaultInfo].files for target in ctx.attr.srcs])
|
||||
runfiles = ctx.runfiles().merge_all([
|
||||
target[DefaultInfo].default_runfiles
|
||||
for target in ctx.attr.srcs
|
||||
])
|
||||
return [DefaultInfo(files = files, runfiles = runfiles)]
|
||||
|
||||
_v8_artifact_files = rule(
|
||||
implementation = _profiled_files_impl,
|
||||
doc = "Build a source archive or release pair under its named V8 profile.",
|
||||
attrs = {
|
||||
"profile": attr.string(
|
||||
mandatory = True,
|
||||
values = ["source", "release", "sandbox_release"],
|
||||
),
|
||||
"srcs": attr.label_list(allow_files = True, cfg = _artifact_profile, mandatory = True),
|
||||
"v8_cpu": attr.string(mandatory = True, values = ["arm64", "x64"]),
|
||||
"_allowlist_function_transition": attr.label(
|
||||
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
||||
),
|
||||
"_arm64": attr.label(default = _CPU_CONSTRAINTS["arm64"]),
|
||||
"_x64": attr.label(default = _CPU_CONSTRAINTS["x64"]),
|
||||
},
|
||||
)
|
||||
|
||||
def v8_artifact_files(name, v8_cpu, **kwargs):
|
||||
"""Declare an artifact that is only valid for its requested CPU.
|
||||
|
||||
Fixed-CPU targets without explicit platform constraints can be skipped in
|
||||
wildcard builds. Preserve constraints on targets such as native Windows
|
||||
which already specify their CPU and ABI. The rule checks the resolved CPU
|
||||
in both cases, including values chosen by select().
|
||||
The generator exec platform remains independent of this target constraint.
|
||||
"""
|
||||
if type(v8_cpu) == "string":
|
||||
kwargs.setdefault("target_compatible_with", [_CPU_CONSTRAINTS[v8_cpu]])
|
||||
_v8_artifact_files(name = name, v8_cpu = v8_cpu, **kwargs)
|
||||
Vendored
+2
-2
@@ -23,8 +23,8 @@ load("@v8_python_deps//:requirements.bzl", "requirement")
|
||||
# Used by the Codex-owned pip hub; pin changes travel with the V8 source.
|
||||
exports_files(["bazel/requirements.txt"])
|
||||
|
||||
# Codex V8 source policy. Only ABI, runtime and target CPU vary; these still
|
||||
# accept the existing release inputs. CPU selection lives in bazel/config.
|
||||
# Codex V8 source policy. Only ABI, runtime and target CPU vary, selected by
|
||||
# artifact profiles. CPU selection lives in bazel/config.
|
||||
# Upstream experiments, profiling and debug flags use their pinned 15.2 defaults.
|
||||
# ICU and no-ICU remain separate targets for the engine and its generators.
|
||||
v8_flag(name = "v8_enable_sandbox")
|
||||
|
||||
Vendored
+2
-1
@@ -2,7 +2,8 @@
|
||||
|
||||
The root package is placed inside the fetched source tree so relative source
|
||||
labels and globs have their normal Bazel semantics. Reuse upstream's platform
|
||||
and CPU configuration in place, with Codex's narrow patch to bazel/defs.bzl.
|
||||
and CPU configuration in place, with Codex's narrow patch to bazel/defs.bzl
|
||||
and the target CPU setting.
|
||||
V8's MODULE and toolchain BUILD files are never part of Codex's dependency or
|
||||
toolchain graph.
|
||||
"""
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@ def _options_impl(ctx):
|
||||
return FlagInfo(value = ctx.build_setting_value)
|
||||
|
||||
# Source-only features keep upstream select names without adding CLI options.
|
||||
# ABI/runtime settings are still V8 release inputs until artifact profiles take over.
|
||||
# ABI/runtime selections are internal settings controlled by artifact profiles.
|
||||
v8_fixed_source_features = rule(
|
||||
implementation = _options_impl,
|
||||
build_setting = config.bool(flag = False),
|
||||
|
||||
Vendored
+39
-4
@@ -1,13 +1,34 @@
|
||||
# What: adapt the pinned V8 rule helpers to Codex's engine configuration.
|
||||
# Scope: bazel/defs.bzl only; the engine graph and dependency choices live in
|
||||
# third_party/v8/engine.BUILD.bazel. The platform/CPU config is unmodified V8.
|
||||
# Preserve the existing release flags, Chromium libc++ headers/runtime, Clang
|
||||
# Windows driver flags, and Windows target-ABI snapshot tool. The optional
|
||||
# Scope: bazel/defs.bzl and bazel/config/v8-target-cpu.bzl; the engine graph
|
||||
# and dependency choices live in third_party/v8/engine.BUILD.bazel. ABI,
|
||||
# runtime and CPU settings are internal outputs of artifact_profile.bzl.
|
||||
# Preserve Chromium libc++ headers/runtime, Clang Windows driver flags, and
|
||||
# the Windows target-ABI snapshot tool. The optional
|
||||
# Linux backtrace link flag is omitted because that feature is fixed off.
|
||||
# On a V8 pin change, review these hunks and build the native canary matrix.
|
||||
|
||||
diff --git a/orig/v8-15.2.124.1/bazel/defs.bzl b/mod/v8-15.2.124.1/bazel/defs.bzl
|
||||
--- a/orig/v8-15.2.124.1/bazel/defs.bzl
|
||||
+++ b/mod/v8-15.2.124.1/bazel/defs.bzl
|
||||
@@ -18,16 +18,16 @@
|
||||
return FlagInfo(value = ctx.build_setting_value)
|
||||
|
||||
_create_option_flag = rule(
|
||||
implementation = _options_impl,
|
||||
- build_setting = config.bool(flag = True),
|
||||
+ build_setting = config.bool(flag = False),
|
||||
attrs = {
|
||||
"scope": attr.string(),
|
||||
},
|
||||
)
|
||||
|
||||
_create_option_string = rule(
|
||||
implementation = _options_impl,
|
||||
- build_setting = config.string(flag = True),
|
||||
+ build_setting = config.string(flag = False),
|
||||
attrs = {
|
||||
"scope": attr.string(),
|
||||
},
|
||||
@@ -42,12 +42,30 @@
|
||||
)
|
||||
|
||||
@@ -174,3 +195,17 @@
|
||||
suffix = suffix,
|
||||
target_os = select({
|
||||
"@v8//bazel/config:is_macos": "mac",
|
||||
diff --git a/orig/v8-15.2.124.1/bazel/config/v8-target-cpu.bzl b/mod/v8-15.2.124.1/bazel/config/v8-target-cpu.bzl
|
||||
--- a/orig/v8-15.2.124.1/bazel/config/v8-target-cpu.bzl
|
||||
+++ b/mod/v8-15.2.124.1/bazel/config/v8-target-cpu.bzl
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
v8_target_cpu = rule(
|
||||
implementation = _host_target_cpu_impl,
|
||||
- build_setting = config.string(flag = True),
|
||||
- doc = "CPU that V8 will generate code for.",
|
||||
+ build_setting = config.string(flag = False),
|
||||
+ doc = "Internal CPU that V8 generates code for; set by the artifact transition.",
|
||||
attrs = {
|
||||
"scope": attr.string(),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user