fn main() -> Result<(), Box<dyn std::error::Error>> {
let proto = if std::path::Path::new("proto/orca.proto").exists() {
"proto/orca.proto"
} else {
"../../proto/orca.proto"
};
tonic_build::compile_protos(proto)?;
let hash = std::process::Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.ok()
.and_then(|o| String::from_utf8(o.stdout).ok())
.unwrap_or_else(|| "unknown".into());
println!("cargo:rustc-env=ORCA_COMMIT={}", hash.trim());
Ok(())
}