fix(proto): build script
Some checks failed
ci/woodpecker/pr/server-audit Pipeline was successful
ci/woodpecker/pr/server-lint Pipeline failed
ci/woodpecker/pr/server-vet Pipeline failed
ci/woodpecker/pr/server-test Pipeline was successful

This commit is contained in:
CleverWild
2026-03-26 21:25:38 +01:00
parent dc80abda98
commit fd46f8fb6e

View File

@@ -1,21 +1,28 @@
use tonic_prost_build::configure;
use std::path::PathBuf;
use tonic_prost_build::{Config, configure};
static PROTOBUF_DIR: &str = "../../../protobufs";
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("cargo::rerun-if-changed={PROTOBUF_DIR}");
let protoc_path = protoc_bin_vendored::protoc_bin_path()?;
let protoc_include = protoc_bin_vendored::include_path()?;
let mut config = Config::new();
config.protoc_executable(protoc_path);
let protos = [
PathBuf::from(format!("{}/arbiter.proto", PROTOBUF_DIR)),
PathBuf::from(format!("{}/user_agent.proto", PROTOBUF_DIR)),
PathBuf::from(format!("{}/client.proto", PROTOBUF_DIR)),
PathBuf::from(format!("{}/evm.proto", PROTOBUF_DIR)),
];
let includes = [PathBuf::from(PROTOBUF_DIR), protoc_include];
configure()
.message_attribute(".", "#[derive(::kameo::Reply)]")
.compile_protos(
&[
format!("{}/arbiter.proto", PROTOBUF_DIR),
format!("{}/user_agent.proto", PROTOBUF_DIR),
format!("{}/client.proto", PROTOBUF_DIR),
format!("{}/evm.proto", PROTOBUF_DIR),
],
&[PROTOBUF_DIR.to_string()],
)
.unwrap();
.compile_with_config(config, &protos, &includes)?;
Ok(())
}