diff --git a/.github/scripts/rusty_v8_bazel.py b/.github/scripts/rusty_v8_bazel.py index 4813b65d40..f2eef61ada 100644 --- a/.github/scripts/rusty_v8_bazel.py +++ b/.github/scripts/rusty_v8_bazel.py @@ -282,53 +282,6 @@ def stage_artifacts( print(staged_checksums) -def v8_checkout_version(source_root: Path) -> str: - version_header = source_root / "v8" / "include" / "v8-version.h" - values: dict[str, str] = {} - for name, value in re.findall( - r"^#define V8_(MAJOR_VERSION|MINOR_VERSION|BUILD_NUMBER|PATCH_LEVEL) ([0-9]+)$", - version_header.read_text(), - flags=re.MULTILINE, - ): - values[name] = value - expected_names = {"MAJOR_VERSION", "MINOR_VERSION", "BUILD_NUMBER", "PATCH_LEVEL"} - if values.keys() != expected_names: - raise SystemExit(f"could not resolve V8 version from {version_header}") - return ".".join( - values[name] - for name in ["MAJOR_VERSION", "MINOR_VERSION", "BUILD_NUMBER", "PATCH_LEVEL"] - ) - - -def sync_upstream_v8_source( - source_root: Path, - source_version: str | None = None, -) -> None: - source_root = source_root.resolve() - source_version = source_version or resolved_v8_source_version() - v8_root = source_root / "v8" - subprocess.run( - ["git", "fetch", "--depth=1", "origin", f"refs/tags/{source_version}"], - cwd=v8_root, - check=True, - ) - subprocess.run( - ["git", "checkout", "--detach", "FETCH_HEAD"], - cwd=v8_root, - check=True, - ) - subprocess.run( - [sys.executable, "tools/update_deps.py"], - cwd=source_root, - check=True, - ) - actual_version = v8_checkout_version(source_root) - if actual_version != source_version: - raise SystemExit( - f"expected V8 {source_version} after source sync, found {actual_version}" - ) - - def upstream_release_pair_paths(source_root: Path, target: str) -> tuple[Path, Path]: lib_name = ( "rusty_v8.lib" if target.endswith("-pc-windows-msvc") else "librusty_v8.a" @@ -407,12 +360,6 @@ def parse_args() -> argparse.Namespace: stage_upstream_release_pair_parser.add_argument("--output-dir", required=True) stage_upstream_release_pair_parser.add_argument("--sandbox", action="store_true") - sync_upstream_source_parser = subparsers.add_parser("sync-upstream-source") - sync_upstream_source_parser.add_argument( - "--source-root", type=Path, required=True - ) - sync_upstream_source_parser.add_argument("--v8-version") - subparsers.add_parser("resolved-v8-crate-version") subparsers.add_parser("resolved-v8-source-version") subparsers.add_parser("rusty-v8-release-tag") @@ -458,12 +405,6 @@ def main() -> int: sandbox=args.sandbox, ) return 0 - if args.command == "sync-upstream-source": - sync_upstream_v8_source( - source_root=args.source_root, - source_version=args.v8_version, - ) - return 0 if args.command == "resolved-v8-crate-version": print(resolved_v8_crate_version()) return 0 diff --git a/.github/scripts/test_rusty_v8_bazel.py b/.github/scripts/test_rusty_v8_bazel.py index 7ca8364b6a..f5006a7684 100644 --- a/.github/scripts/test_rusty_v8_bazel.py +++ b/.github/scripts/test_rusty_v8_bazel.py @@ -2,7 +2,6 @@ from __future__ import annotations -import subprocess import textwrap import unittest from os import environ @@ -83,82 +82,6 @@ class RustyV8BazelTest(unittest.TestCase): rusty_v8_bazel.resolved_v8_source_version(module_bazel), ) - def test_v8_checkout_version_reads_version_header(self) -> None: - with TemporaryDirectory() as temp_dir: - source_root = Path(temp_dir) - version_header = source_root / "v8" / "include" / "v8-version.h" - version_header.parent.mkdir(parents=True) - version_header.write_text( - textwrap.dedent( - """\ - #define V8_MAJOR_VERSION 14 - #define V8_MINOR_VERSION 9 - #define V8_BUILD_NUMBER 207 - #define V8_PATCH_LEVEL 35 - """ - ) - ) - - self.assertEqual( - "14.9.207.35", - rusty_v8_bazel.v8_checkout_version(source_root), - ) - - def test_sync_upstream_v8_source_checks_out_requested_tag(self) -> None: - with TemporaryDirectory() as temp_dir: - root = Path(temp_dir) - remote = root / "remote" - version_header = remote / "include" / "v8-version.h" - version_header.parent.mkdir(parents=True) - version_header.write_text( - textwrap.dedent( - """\ - #define V8_MAJOR_VERSION 14 - #define V8_MINOR_VERSION 9 - #define V8_BUILD_NUMBER 207 - #define V8_PATCH_LEVEL 35 - """ - ) - ) - git = ["git", "-C", str(remote)] - subprocess.run(["git", "init", str(remote)], check=True, capture_output=True) - subprocess.run([*git, "add", "."], check=True, capture_output=True) - subprocess.run( - [ - *git, - "-c", - "user.name=Codex Test", - "-c", - "user.email=codex@example.com", - "commit", - "-m", - "V8 source", - ], - check=True, - capture_output=True, - ) - subprocess.run( - [*git, "tag", "14.9.207.35"], check=True, capture_output=True - ) - - source_root = root / "rusty_v8" - source_root.mkdir() - subprocess.run( - ["git", "clone", str(remote), str(source_root / "v8")], - check=True, - capture_output=True, - ) - tools = source_root / "tools" - tools.mkdir() - (tools / "update_deps.py").write_text("") - - rusty_v8_bazel.sync_upstream_v8_source(source_root, "14.9.207.35") - - self.assertEqual( - "14.9.207.35", - rusty_v8_bazel.v8_checkout_version(source_root), - ) - def test_command_version_tracks_remaining_http_file_assets(self) -> None: with TemporaryDirectory() as temp_dir: module_bazel = Path(temp_dir) / "MODULE.bazel" diff --git a/.github/workflows/rusty-v8-release.yml b/.github/workflows/rusty-v8-release.yml index ff3c38ede4..77b8d493c0 100644 --- a/.github/workflows/rusty-v8-release.yml +++ b/.github/workflows/rusty-v8-release.yml @@ -322,12 +322,6 @@ jobs: python-version: "3.11" architecture: x64 - - name: Check out pinned V8 source and dependencies - shell: bash - run: | - python3 .github/scripts/rusty_v8_bazel.py sync-upstream-source \ - --source-root upstream-rusty-v8 - - name: Set up Codex Rust toolchain for Cargo smoke uses: dtolnay/rust-toolchain@e081816240890017053eacbb1bdf337761dc5582 # 1.95.0 with: diff --git a/.github/workflows/v8-canary.yml b/.github/workflows/v8-canary.yml index 5e77151b34..53d9585108 100644 --- a/.github/workflows/v8-canary.yml +++ b/.github/workflows/v8-canary.yml @@ -343,12 +343,6 @@ jobs: python-version: "3.11" architecture: x64 - - name: Check out pinned V8 source and dependencies - shell: bash - run: | - python3 .github/scripts/rusty_v8_bazel.py sync-upstream-source \ - --source-root upstream-rusty-v8 - - name: Set up Codex Rust toolchain for Cargo smoke uses: dtolnay/rust-toolchain@e081816240890017053eacbb1bdf337761dc5582 # 1.95.0 with: diff --git a/third_party/v8/README.md b/third_party/v8/README.md index 5da0e0f589..91961e7a7b 100644 --- a/third_party/v8/README.md +++ b/third_party/v8/README.md @@ -93,10 +93,10 @@ The same run also builds the matching sandbox pair targets: The workflow also builds sandbox-enabled `x86_64-pc-windows-msvc` and `aarch64-pc-windows-msvc` archive/binding pairs -from the matching upstream `rusty_v8` crate source, after synchronizing its V8 -checkout and Chromium dependencies to the source version pinned in -`MODULE.bazel`. Those ABI-specific outputs cannot be produced by Codex's Bazel -Windows GNU toolchain. +from the upstream `rusty_v8` crate source. These outputs use that crate's own V8 +checkout, which may differ from the V8 source version in the Codex artifact tag. +This is a known temporary exception: 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 v149.2.0`, compiles published artifact targets with @@ -119,6 +119,8 @@ assets directly. We do not use `RUSTY_V8_MIRROR` because the upstream `v8` crate hardcodes a `v` tag layout, while our artifacts are published under `rusty-v8-v-v8-`. -Do not mix artifacts across crate or source versions. The archive and binding -must match both the exact resolved `v8` crate version in `codex-rs/Cargo.lock` -and the embedded V8 source version in `MODULE.bazel`. +For Codex-built artifacts, do not mix artifacts across crate or source versions. +The archive and binding must match both the exact resolved `v8` crate version in +`codex-rs/Cargo.lock` and the embedded V8 source version in `MODULE.bazel`. The +Windows MSVC exception above matches the crate version but does not yet +guarantee the tagged Codex source version.