-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
88 lines (75 loc) · 1.93 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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::zkpverify::MsgSubmitCommunityVerification,
"fiamma.zkpverify",
"MsgSubmitCommunityVerification"
);
impl_name!(
fiamma::bitvmstaker::MsgCreateStaker,
"fiamma.bitvmstaker",
"MsgCreateStaker"
);
impl_name!(
fiamma::bitvmstaker::MsgRemoveStaker,
"fiamma.bitvmstaker",
"MsgRemoveStaker"
);
impl_name!(
fiamma::bitvmstaker::MsgRegisterVk,
"fiamma.bitvmstaker",
"MsgRegisterVK"
);
impl_name!(
fiamma::bitvmstaker::MsgRemoveVk,
"fiamma.bitvmstaker",
"MsgRemoveVK"
);
"#;
let out_dir = "src/generated";
tonic_build::configure().out_dir(out_dir).compile(
&[
"src/protos/fiamma/zkpverify/tx.proto",
"src/protos/fiamma/zkpverify/query.proto",
"src/protos/fiamma/bitvmstaker/tx.proto",
"src/protos/fiamma/bitvmstaker/query.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(())
}