mirror of
https://github.com/openai/codex.git
synced 2026-10-19 16:17:49 +00:00
## What changed Use the stable and experimental bundles generated by `//bazel/schema:app-server` as compile-time inputs for `app-server-protocol` instead of the checked-in bundles. Generalize `schema_generator_sources` to `schema_sources` so it can stage Rust sources alongside generated bundles. Keep empty bundle placeholders for the on-demand schema generator, which derives its output from Rust sources. GitOrigin-RevId: a976c420a3698d631f3ea7c698b15b82391158e5
78 lines
2.0 KiB
Python
78 lines
2.0 KiB
Python
load("@crates//:defs.bzl", "all_crate_deps")
|
|
load("@rules_rust//rust:defs.bzl", "rust_binary")
|
|
load("//:defs.bzl", "WINDOWS_RUSTC_LINK_FLAGS", "codex_rust_crate")
|
|
load("//bazel/rules:schema_bundle.bzl", "schema_sources")
|
|
|
|
schema_sources(
|
|
name = "schema-sources",
|
|
srcs = glob(["src/**/*.rs"]),
|
|
schema = "//bazel/schema:app-server",
|
|
)
|
|
|
|
filegroup(
|
|
name = "schema-precomputed",
|
|
srcs = [":schema-sources"],
|
|
output_group = "precomputed",
|
|
)
|
|
|
|
codex_rust_crate(
|
|
name = "app-server-protocol",
|
|
compile_data = [":schema-precomputed"],
|
|
crate_name = "codex_app_server_protocol",
|
|
crate_srcs = [":schema-sources"],
|
|
test_data_extra = glob(
|
|
["schema/**"],
|
|
allow_empty = True,
|
|
),
|
|
)
|
|
|
|
alias(
|
|
name = "schema-generator",
|
|
testonly = True,
|
|
actual = ":app-server-protocol-unit-tests-bin",
|
|
tags = ["manual"],
|
|
visibility = ["//bazel/schema:__pkg__"],
|
|
)
|
|
|
|
schema_sources(
|
|
name = "schema-generator-sources",
|
|
srcs = glob(["src/**/*.rs"]),
|
|
tags = ["manual"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "schema-generator-root",
|
|
srcs = [":schema-generator-sources"],
|
|
output_group = "crate_root",
|
|
tags = ["manual"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "schema-generator-placeholders",
|
|
srcs = [":schema-generator-sources"],
|
|
output_group = "precomputed",
|
|
tags = ["manual"],
|
|
)
|
|
|
|
# Compile the crate's test harness, including its unit tests.
|
|
# Each schema action runs only write_schema_fixtures_from_env via --exact --ignored.
|
|
rust_binary(
|
|
name = "schema-generator-on-demand",
|
|
srcs = [":schema-generator-sources"],
|
|
compile_data = [":schema-generator-placeholders"],
|
|
crate_name = "codex_app_server_protocol",
|
|
crate_root = ":schema-generator-root",
|
|
edition = "2024",
|
|
rustc_env = {
|
|
"BAZEL_PACKAGE": "codex-rs/app-server-protocol",
|
|
"CARGO_PKG_NAME": "codex-app-server-protocol",
|
|
},
|
|
rustc_flags = ["--test"] + WINDOWS_RUSTC_LINK_FLAGS,
|
|
tags = ["manual"],
|
|
visibility = ["//bazel/schema:__pkg__"],
|
|
deps = all_crate_deps(
|
|
normal = True,
|
|
normal_dev = True,
|
|
),
|
|
)
|