extern crate protoc_rust;
use protoc_rust::Customize;
use std::env;
use std::fs;
use std::fs::File;
use std::io::Write;
use std::path::Path;
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("protos");
let proto_path = Path::new("./protos");
fs::create_dir_all(&dest_path).unwrap();
protoc_rust::run(protoc_rust::Args {
out_dir: &dest_path.to_str().unwrap(),
input: &[
proto_path.join("batch.proto").to_str().unwrap(),
proto_path.join("transaction.proto").to_str().unwrap(),
proto_path.join("events.proto").to_str().unwrap(),
proto_path
.join("transaction_receipt.proto")
.to_str()
.unwrap(),
proto_path.join("merkle.proto").to_str().unwrap(),
],
includes: &[proto_path.to_str().unwrap()],
customize: Customize::default(),
})
.expect("Protoc Error");
let mut mod_file = File::create(dest_path.join("mod.rs")).unwrap();
mod_file
.write_all(b"pub mod batch;\npub mod events;\npub mod transaction;\npub mod transaction_receipt;\npub mod merkle;\n")
.unwrap();
}