Skip to content

Commit 0bf277a

Browse files
committed
Add Vss thin client protobuf generation & build/CI setup
1 parent 1bd7c47 commit 0bf277a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

vss-accessor/build.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
extern crate prost_build;
2+
3+
use std::fs;
4+
use std::fs::File;
5+
use std::path::Path;
6+
7+
fn main() {
8+
download_file(
9+
"https://raw.githubusercontent.com/lightningdevkit/vss-server/main/app/src/main/proto/vss.proto",
10+
"src/proto/vss.proto",
11+
)
12+
.unwrap();
13+
14+
prost_build::compile_protos(&["src/proto/vss.proto"], &["src/"]).unwrap();
15+
}
16+
17+
fn download_file(url: &str, save_to: &str) -> Result<(), Box<dyn std::error::Error>> {
18+
let mut response = reqwest::blocking::get(url)?;
19+
fs::create_dir_all(Path::new(save_to).parent().unwrap())?;
20+
let mut out_file = File::create(save_to)?;
21+
response.copy_to(&mut out_file)?;
22+
Ok(())
23+
}

0 commit comments

Comments
 (0)