File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,10 @@ build = "build.rs"
1515prost = " 0.11.6"
1616reqwest = { version = " 0.11.13" , features = [" rustls-tls" ] }
1717
18- [build-dependencies ]
18+ [target . 'cfg(genproto)' . build-dependencies ]
1919prost-build = { version = " 0.11.3" }
2020reqwest = { version = " 0.11.13" , features = [" blocking" ] }
2121
2222[dev-dependencies ]
2323mockito = " 0.31.1"
2424tokio = { version = " 1.22.0" , features = [" macros" ]}
25-
26- [features ]
27- genproto = []
Original file line number Diff line number Diff line change 1- #[ cfg( feature = " genproto" ) ]
1+ #[ cfg( genproto) ]
22extern crate prost_build;
3- #[ cfg( feature = " genproto" ) ]
3+ #[ cfg( genproto) ]
44use std:: { env, fs, fs:: File , path:: Path } ;
55
66/// To generate updated proto objects:
77/// 1. Place `vss.proto` file in `src/proto/`
8- /// 2. run `cargo build --features= genproto`
8+ /// 2. run `RUSTFLAGS="--cfg genproto" cargo build `
99fn main ( ) {
10- #[ cfg( feature = " genproto" ) ]
10+ #[ cfg( genproto) ]
1111 generate_protos ( ) ;
1212}
1313
14- #[ cfg( feature = " genproto" ) ]
14+ #[ cfg( genproto) ]
1515fn generate_protos ( ) {
1616 download_file (
1717 "https://raw.githubusercontent.com/lightningdevkit/vss-server/cb1159c3b1835c66a857b25b114f15d18d2a4297/app/src/main/proto/vss.proto" ,
@@ -23,7 +23,7 @@ fn generate_protos() {
2323 fs:: copy ( from_path, "src/types.rs" ) . unwrap ( ) ;
2424}
2525
26- #[ cfg( feature = " genproto" ) ]
26+ #[ cfg( genproto) ]
2727fn download_file ( url : & str , save_to : & str ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
2828 let mut response = reqwest:: blocking:: get ( url) ?;
2929 fs:: create_dir_all ( Path :: new ( save_to) . parent ( ) . unwrap ( ) ) ?;
You can’t perform that action at this time.
0 commit comments