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"
15
15
prost = " 0.11.6"
16
16
reqwest = { version = " 0.11.13" , features = [" rustls-tls" ] }
17
17
18
- [build-dependencies ]
18
+ [target . 'cfg(genproto)' . build-dependencies ]
19
19
prost-build = { version = " 0.11.3" }
20
20
reqwest = { version = " 0.11.13" , features = [" blocking" ] }
21
21
22
22
[dev-dependencies ]
23
23
mockito = " 0.31.1"
24
24
tokio = { 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) ]
2
2
extern crate prost_build;
3
- #[ cfg( feature = " genproto" ) ]
3
+ #[ cfg( genproto) ]
4
4
use std:: { env, fs, fs:: File , path:: Path } ;
5
5
6
6
/// To generate updated proto objects:
7
7
/// 1. Place `vss.proto` file in `src/proto/`
8
- /// 2. run `cargo build --features= genproto`
8
+ /// 2. run `RUSTFLAGS="--cfg genproto" cargo build `
9
9
fn main ( ) {
10
- #[ cfg( feature = " genproto" ) ]
10
+ #[ cfg( genproto) ]
11
11
generate_protos ( ) ;
12
12
}
13
13
14
- #[ cfg( feature = " genproto" ) ]
14
+ #[ cfg( genproto) ]
15
15
fn generate_protos ( ) {
16
16
download_file (
17
17
"https://raw.githubusercontent.com/lightningdevkit/vss-server/cb1159c3b1835c66a857b25b114f15d18d2a4297/app/src/main/proto/vss.proto" ,
@@ -23,7 +23,7 @@ fn generate_protos() {
23
23
fs:: copy ( from_path, "src/types.rs" ) . unwrap ( ) ;
24
24
}
25
25
26
- #[ cfg( feature = " genproto" ) ]
26
+ #[ cfg( genproto) ]
27
27
fn download_file ( url : & str , save_to : & str ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
28
28
let mut response = reqwest:: blocking:: get ( url) ?;
29
29
fs:: create_dir_all ( Path :: new ( save_to) . parent ( ) . unwrap ( ) ) ?;
You can’t perform that action at this time.
0 commit comments