solstice-ci/crates/runner-integration/build.rs

30 lines
1.1 KiB
Rust
Raw Permalink Normal View History

fn main() {
println!("cargo:rerun-if-changed=proto/runner/v1/messages.proto");
println!("cargo:rerun-if-changed=proto/runner/v1/services.proto");
// Include system protobuf path for google/protobuf well-known types
// (e.g. /usr/include from protobuf-compiler in container builds).
let mut include_dirs = vec!["proto".to_string()];
for candidate in ["/usr/include", "/usr/local/include"] {
let p = std::path::Path::new(candidate).join("google/protobuf/timestamp.proto");
if p.exists() {
include_dirs.push(candidate.to_string());
break;
}
}
let include_refs: Vec<&str> = include_dirs.iter().map(|s| s.as_str()).collect();
tonic_prost_build::configure()
.build_server(false)
.build_client(false) // We implement connect-rpc transport manually
.compile_protos(
&[
"proto/runner/v1/messages.proto",
"proto/runner/v1/services.proto",
],
&include_refs,
)
.expect("failed to compile Forgejo actions proto");
}