Use SQLite for persistence and generate Rust protobuf bindings at build time. Add Docker image support for containerized deployment. Co-Authored-By: codex <[email protected]>
22 lines
646 B
Rust
22 lines
646 B
Rust
use std::{env, path::PathBuf};
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
let proto_dir = PathBuf::from("schema/protobuf/sync_pb");
|
|
let mut protos = Vec::new();
|
|
for entry in std::fs::read_dir(&proto_dir)? {
|
|
let path = entry?.path();
|
|
if path.extension().is_some_and(|ext| ext == "proto") {
|
|
println!("cargo:rerun-if-changed={}", path.display());
|
|
protos.push(path);
|
|
}
|
|
}
|
|
|
|
let protoc = protoc_bin_vendored::protoc_bin_path()?;
|
|
unsafe {
|
|
env::set_var("PROTOC", protoc);
|
|
}
|
|
|
|
prost_build::Config::new().compile_protos(&protos, &[proto_dir])?;
|
|
Ok(())
|
|
}
|