-
Notifications
You must be signed in to change notification settings - Fork 45
/
build.rs
39 lines (34 loc) · 1.03 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
use std::path::PathBuf;
fn main() -> std::io::Result<()> {
println!("cargo:rerun-if-env-changed=LND_REPO_DIR");
let dir = match std::env::var_os("LND_REPO_DIR") {
Some(lnd_repo_path) => {
let mut lnd_rpc_dir = PathBuf::from(lnd_repo_path);
lnd_rpc_dir.push("lnrpc");
lnd_rpc_dir
},
None => PathBuf::from("vendor"),
};
let lnd_rpc_proto_file = dir.join("lightning.proto");
println!("cargo:rerun-if-changed={}", lnd_rpc_proto_file.display());
let protos = [
"signrpc/signer.proto",
"walletrpc/walletkit.proto",
"lightning.proto",
"peersrpc/peers.proto",
"verrpc/verrpc.proto",
];
let proto_paths: Vec<_> = protos
.iter()
.map(|proto| {
let proto_path = dir.join(proto);
proto_path
})
.collect();
tonic_build::configure()
.build_client(true)
.build_server(false)
.format(false)
.compile(&proto_paths, &[dir])?;
Ok(())
}