File tree Expand file tree Collapse file tree 3 files changed +168
-8
lines changed
Expand file tree Collapse file tree 3 files changed +168
-8
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ prost-build = "0.13"
2525protobuf-support = " 3.7.1"
2626protobuf = " 3.7.1"
2727protobuf-parse = " 3.7.1"
28+ protox = " 0.8"
2829glob = " 0"
2930prettyplease = " 0.2"
3031quote = " 1.0"
Original file line number Diff line number Diff line change @@ -18,8 +18,12 @@ fn main() {
1818 let descriptor = protobuf:: reflect:: FileDescriptor :: new_dynamic ( protofile. clone ( ) , & [ ] )
1919 . expect ( "Could not create descriptor" ) ;
2020
21- // Now we use the prost crate to compile them, so that we can
22- // generate Rust structs.
21+ // Now we use protox + prost-build for pure Rust compilation (no protoc needed)
22+ let file_descriptors = protox:: compile (
23+ [ "Lib/axisregistry/axes.proto" ] ,
24+ [ "Lib/axisregistry" ]
25+ ) . expect ( "Could not compile axes.proto with protox" ) ;
26+
2327 let mut config = prost_build:: Config :: new ( ) ;
2428 // config.boxed(".google.axes.LanguageProto.sample_text");
2529 // config.boxed(".google.axes.LanguageProto.exemplar_chars");
@@ -34,8 +38,8 @@ fn main() {
3438 }
3539 // Let's make our structs; this produces google.axes.rs
3640 config
37- . compile_protos ( & [ "Lib/axisregistry/axes.proto" ] , & [ "Lib/axisregistry/" ] )
38- . expect ( "Could not compile axes. proto" ) ;
41+ . compile_fds ( file_descriptors )
42+ . expect ( "Could not compile proto file_descriptors " ) ;
3943
4044 let path = Path :: new ( & env:: var ( "OUT_DIR" ) . unwrap ( ) ) . join ( "data.rs" ) ;
4145 let mut file = BufWriter :: new ( File :: create ( path) . unwrap ( ) ) ;
You can’t perform that action at this time.
0 commit comments