0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-12-15 07:29:41 +00:00
2024-01-11 09:40:05 -05:00

38 lines
970 B
Rust

use std::{path::PathBuf, process::Command};
#[test]
fn bootstrap() {
let iface_files = &[
"proto/metadata.proto",
"proto/replication_log.proto",
"proto/proxy.proto",
];
let dirs = &["proto"];
let out_dir = PathBuf::from(std::env!("CARGO_MANIFEST_DIR"))
.join("src")
.join("generated");
let mut config = prost_build::Config::new();
config.bytes([".wal_log"]);
tonic_build::configure()
.build_client(true)
.build_server(true)
.build_transport(true)
.out_dir(&out_dir)
.type_attribute(".proxy", "#[derive(serde::Serialize, serde::Deserialize)]")
.compile_with_config(config, iface_files, dirs)
.unwrap();
let status = Command::new("git")
.arg("diff")
.arg("--exit-code")
.arg("--")
.arg(&out_dir)
.status()
.unwrap();
assert!(status.success(), "You should commit the protobuf files");
}