-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
58 lines (49 loc) · 1.33 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use std::{fs, path::PathBuf};
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Build finished");
let code_string = r#"//@Generated code from proto by tonic, do NOT edit!
pub mod cosmos {
pub mod base {
pub mod query {
pub mod v1beta1 {
include!("cosmos.base.query.v1beta1.rs");
}
}
}
}
pub mod fiamma {
pub mod zkpverify {
include!("fiamma.zkpverify.rs");
}
pub mod bitvmstaker {
include!("fiamma.bitvmstaker.rs");
}
}
use cosmrs::proto::traits::Name;
macro_rules! impl_name {
($type:ty, $package:expr, $name:expr) => {
impl Name for $type {
const NAME: &'static str = $name;
const PACKAGE: &'static str = $package;
}
};
}
impl_name!(
fiamma::zkpverify::MsgSubmitProof,
"fiamma.zkpverify",
"MsgSubmitProof"
);
impl_name!(
fiamma::bitvmstaker::MsgCreateStaker,
"fiamma.bitvmstaker",
"MsgCreateStaker"
);"#;
let out_dir = "src/generated";
tonic_build::configure().out_dir(out_dir).compile(
&["src/protos/zkpverify.proto", "src/protos/bitvmstaker.proto"],
&["src/protos", "src/protos/third_party"],
)?;
fs::write(PathBuf::from(out_dir).join("mod.rs"), code_string).unwrap();
println!("cargo:rerun-if-changed=build.rs");
Ok(())
}