forked from fedimint/tonic_lnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
35 lines (30 loc) · 1.01 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
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",
"routerrpc/router.proto",
"invoicesrpc/invoices.proto",
"staterpc/state.proto",
];
let proto_paths: Vec<_> = protos.iter().map(|proto| dir.join(proto)).collect();
tonic_build::configure()
.build_client(true)
.build_server(false)
.compile(&proto_paths, &[dir])?;
Ok(())
}