Files
codex/codex-rs/config-schema/src/main.rs
T
zbarsky-openai 1099fe0694 Use hermetic LLVM for Windows MSVC Bazel builds (#60507)
## Why

Windows MSVC builds relied on installed C++ toolchains, and V8 snapshot generation required native Windows execution. Cross-compiling V8 also needs a Windows snapshot generator to preserve Windows unwind metadata.

## What changed

- Use the registered hermetic LLVM toolchain and declared Microsoft SDK for Windows MSVC builds, with static CRT linkage and the toolchain's declared `lld-link` for Rust.
- Run Windows V8 snapshot generators natively or through `rules_wine` on Linux, preserving target CPU, OS, and sandbox settings. Keep separate archive and binding pairs for the workspace's ISO stdio ABI and the distributed MSVC stdio ABI.
- Update build dependencies and bindgen, scope V8's Chromium libc++ settings to its own targets, and adapt native voice dependencies for clang-cl and Windows ARM64.
- Build SQLite directly with Bazel and give `openssl-sys` an explicit build using Bazel's OpenSSL.
- Remove build-worker source-directory dependencies from Bazel resource lookup, schema output discovery, and snapshot paths; embed assets in debug builds as well.

GitOrigin-RevId: fd224d9d28d73a67baf90f6d73c6079d60f20351
2026-11-10 03:02:25 +00:00

44 lines
1.4 KiB
Rust

//! Generates the canonical config schema fixture for development and releases.
use anyhow::Result;
use clap::Parser;
use std::path::PathBuf;
/// Generate the JSON Schema for `config.toml` and write it to `config.schema.json`.
#[derive(Parser)]
#[command(name = "codex-write-config-schema")]
struct Args {
#[arg(short, long, value_name = "PATH")]
out: Option<PathBuf>,
}
fn main() -> Result<()> {
let args = Args::parse();
let out_path = match args.out {
Some(path) => path,
None => default_out_path()?,
};
codex_config::schema::write_config_schema(&out_path)?;
Ok(())
}
fn default_out_path() -> Result<PathBuf> {
// Cargo supplies this when running the tool, including from outside the checkout.
if let Some(manifest_dir) = std::env::var_os("CARGO_MANIFEST_DIR") {
return Ok(PathBuf::from(manifest_dir).join("../core/config.schema.json"));
}
let cwd = std::env::current_dir()?;
for directory in cwd.ancestors() {
for workspace in [directory.to_path_buf(), directory.join("codex-rs")] {
if workspace.join("config-schema/Cargo.toml").is_file()
&& workspace.join("core/Cargo.toml").is_file()
{
return Ok(workspace.join("core/config.schema.json"));
}
}
}
anyhow::bail!("could not locate the Codex checkout; specify the schema output with --out")
}