mirror of
https://github.com/openai/codex.git
synced 2026-05-18 18:22:39 +00:00
v8: include CRDTP bindings in 147 Bazel builds
Add the `crdtp_binding.cc` source and CRDTP headers to the 147 Bazel V8 binding target so Windows GNU builds provide the symbols required by the `v8::crdtp` Rust APIs. Add a regression test that exercises CRDTP JSON conversion and dispatchable message parsing.
This commit is contained in:
@@ -78,4 +78,15 @@ mod tests {
|
||||
fn evaluates_string_concatenation() {
|
||||
assert_eq!(evaluate_expression("'hello ' + 'world'"), "hello world");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_crdtp_dispatchable_messages() {
|
||||
let cbor = v8::crdtp::json_to_cbor(br#"{"id":7,"method":"Runtime.evaluate","params":{}}"#)
|
||||
.expect("JSON should convert to CBOR");
|
||||
let dispatchable = v8::crdtp::Dispatchable::new(&cbor);
|
||||
|
||||
assert!(dispatchable.ok());
|
||||
assert_eq!(dispatchable.call_id(), 7);
|
||||
assert_eq!(dispatchable.method(), b"Runtime.evaluate");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ index 421ebcd..52283ea 100644
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4465,6 +4474,15 @@ filegroup(
|
||||
@@ -4465,6 +4474,35 @@ filegroup(
|
||||
],
|
||||
)
|
||||
|
||||
@@ -230,6 +230,26 @@ index 421ebcd..52283ea 100644
|
||||
+ strip_include_prefix = "",
|
||||
+ visibility = ["//visibility:public"],
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "rusty_v8_crdtp_headers",
|
||||
+ hdrs = [
|
||||
+ "third_party/inspector_protocol/crdtp/cbor.h",
|
||||
+ "third_party/inspector_protocol/crdtp/dispatch.h",
|
||||
+ "third_party/inspector_protocol/crdtp/error_support.h",
|
||||
+ "third_party/inspector_protocol/crdtp/export.h",
|
||||
+ "third_party/inspector_protocol/crdtp/find_by_first.h",
|
||||
+ "third_party/inspector_protocol/crdtp/frontend_channel.h",
|
||||
+ "third_party/inspector_protocol/crdtp/json.h",
|
||||
+ "third_party/inspector_protocol/crdtp/parser_handler.h",
|
||||
+ "third_party/inspector_protocol/crdtp/protocol_core.h",
|
||||
+ "third_party/inspector_protocol/crdtp/serializable.h",
|
||||
+ "third_party/inspector_protocol/crdtp/span.h",
|
||||
+ "third_party/inspector_protocol/crdtp/status.h",
|
||||
+ ],
|
||||
+ strip_include_prefix = "",
|
||||
+ visibility = ["//visibility:public"],
|
||||
+)
|
||||
+
|
||||
filegroup(
|
||||
name = "d8_files",
|
||||
|
||||
20
third_party/v8/BUILD.bazel
vendored
20
third_party/v8/BUILD.bazel
vendored
@@ -220,6 +220,20 @@ genrule(
|
||||
]),
|
||||
)
|
||||
|
||||
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",
|
||||
@@ -228,11 +242,15 @@ copy_file(
|
||||
|
||||
cc_library(
|
||||
name = "v8_147_4_0_binding",
|
||||
srcs = [":binding_cc_147_4_0"],
|
||||
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": [
|
||||
|
||||
5
third_party/v8/v8_crate.BUILD.bazel
vendored
5
third_party/v8/v8_crate.BUILD.bazel
vendored
@@ -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"],
|
||||
|
||||
Reference in New Issue
Block a user