File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change
1
+ use std:: env;
2
+ use std:: fs;
3
+ use std:: path:: PathBuf ;
4
+
1
5
fn main ( ) {
6
+ let out_dir = env:: var ( "OUT_DIR" ) . unwrap ( ) ;
7
+ let path: PathBuf = [ out_dir. clone ( ) , "mod.rs" . to_string ( ) ] . iter ( ) . collect ( ) ;
8
+ fs:: write ( path, "pub mod ttrpc;" ) . unwrap ( ) ;
9
+
2
10
protobuf_codegen_pure:: Codegen :: new ( )
3
- . out_dir ( "src" )
11
+ . out_dir ( out_dir )
4
12
. inputs ( & [ "src/ttrpc.proto" ] )
5
13
. include ( "src" )
6
14
. run ( )
Original file line number Diff line number Diff line change @@ -20,7 +20,10 @@ pub mod error;
20
20
#[ macro_use]
21
21
pub mod common;
22
22
#[ allow( clippy:: type_complexity, clippy:: too_many_arguments) ]
23
- pub mod ttrpc;
23
+ pub mod compiled {
24
+ include ! ( concat!( env!( "OUT_DIR" ) , "/mod.rs" ) ) ;
25
+ }
26
+ pub use compiled:: ttrpc;
24
27
25
28
pub use crate :: common:: MessageHeader ;
26
29
pub use crate :: error:: { get_status, Error , Result } ;
You can’t perform that action at this time.
0 commit comments