@@ -38,6 +38,7 @@ use include_dir::{
3838use std:: os:: unix:: fs:: PermissionsExt ;
3939use std:: {
4040 convert:: AsRef ,
41+ ffi:: OsStr ,
4142 fs,
4243 io:: Write ,
4344 iter:: IntoIterator ,
@@ -228,17 +229,17 @@ impl GenProtos {
228229 }
229230
230231 fn gen_rust_protos ( & self , temp_dir : tempfile:: TempDir ) -> Output {
232+ let venv_bin = self . create_venv ( & temp_dir) ;
231233 let new_path = {
232- let venv_bin = self . create_venv ( & temp_dir) ;
233234 let mut path: Vec < _ > = std:: env:: split_paths ( & std:: env:: var_os ( "PATH" ) . unwrap ( ) ) . collect ( ) ;
234- path. insert ( 0 , venv_bin) ;
235+ path. insert ( 0 , venv_bin. clone ( ) ) ;
235236 std:: env:: join_paths ( path) . unwrap ( )
236237 } ;
237238 dbg ! ( & new_path) ;
238239
239240 // Create protoc cmd in the venv
240241 let mut protoc_cmd = Command :: new ( "protoc" ) ;
241- protoc_cmd. env ( "PATH" , new_path) ;
242+ protoc_cmd. env ( "PATH" , & new_path) ;
242243 protoc_cmd. env ( "PYTHONPATH" , temp_dir. path ( ) ) ;
243244
244245 // Directories that contain protos
@@ -264,8 +265,24 @@ impl GenProtos {
264265 dbg ! ( path) ;
265266 }
266267
268+ protoc_cmd. arg (
269+ [
270+ OsStr :: new ( "--plugin=protoc-gen-rust_pb_jelly=" ) ,
271+ venv_bin
272+ . join ( if cfg ! ( windows) {
273+ "protoc-gen-rust.exe"
274+ } else {
275+ "protoc-gen-rust"
276+ } )
277+ . as_os_str ( ) ,
278+ ]
279+ . join ( OsStr :: new ( "" ) ) ,
280+ ) ;
281+
267282 // Set the Rust out path
268- protoc_cmd. arg ( "--rust_out" ) ;
283+ // (Don't use "rust" as the name of the plugin because protoc now has (broken) upstream Rust support that
284+ // overrides the plugin)
285+ protoc_cmd. arg ( "--rust_pb_jelly_out" ) ;
269286 protoc_cmd. arg ( & self . gen_path ) ;
270287
271288 // Get paths of our Protos
0 commit comments