[Rust Frontend] Replace external protoc with pure Rust lib protox (#52892)

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
Co-authored-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
Bugen Zhao
2026-08-20 18:43:51 -07:00
committed by GitHub
co-authored by OpenAI Codex Nick Hill
parent 91a893de64
commit 83c5d59209
14 changed files with 181 additions and 125 deletions
+1
View File
@@ -53,6 +53,7 @@ vllm-metrics.workspace = true
vllm-text.workspace = true
[build-dependencies]
protox.workspace = true
tonic-prost-build.workspace = true
[dev-dependencies]
+12 -9
View File
@@ -3,19 +3,22 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let proto_dir = format!("{manifest_dir}/../../proto");
let proto_dir = std::path::PathBuf::from(format!("{manifest_dir}/../../proto"));
let protos = [
proto_dir.join("control.proto"),
proto_dir.join("inference.proto"),
];
for proto in &protos {
println!("cargo:rerun-if-changed={}", proto.display());
}
let file_descriptor_set = protox::compile(&protos, [&proto_dir])?;
tonic_prost_build::configure()
.build_server(true)
.build_client(true)
.protoc_arg("--experimental_allow_proto3_optional") // be compatible with old compilers
.compile_protos(
&[
format!("{proto_dir}/control.proto"),
format!("{proto_dir}/inference.proto"),
],
&[proto_dir],
)?;
.compile_fds(file_descriptor_set)?;
Ok(())
}