Files
roto/examples/hello_world/build.rs
T
charles da7ba47505 Fix generated code and update example integration
Resolve `Result` ambiguity and lifetime issues in generated services.
Use `file_stem` for proto filenames. Make `StatusBody` public in
`roto-tonic` and update the `hello_world` build process.
2026-05-15 10:29:54 -07:00

28 lines
1.0 KiB
Rust

fn main() {
let proto_file = "proto/hello.proto";
let out_dir = std::env::var("OUT_DIR").unwrap();
let dest_path = std::path::Path::new(&out_dir).join("hello.rs");
// Find the protoc-gen-roto binary
// Since we added roto-codegen to build-dependencies, it will be built.
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let target_dir = std::path::Path::new(&manifest_dir).join("../../target/debug");
let plugin_path = target_dir.join("protoc-gen-roto");
if !plugin_path.exists() {
panic!("protoc-gen-roto plugin not found at {:?}", plugin_path);
}
let status = std::process::Command::new("protoc")
.arg(format!("--plugin=protoc-gen-roto={}", plugin_path.display()))
.arg(format!("--roto_out={}", out_dir))
.arg(format!("--roto_opt=src=proto")) // Assuming the plugin handles this or we just pass it
.arg(proto_file)
.status()
.expect("Failed to execute protoc");
if !status.success() {
panic!("protoc failed with status {}", status);
}
}