@@ -362,7 +362,7 @@ fn dist_or_local_compile<T>(dist_client: Arc<dist::Client>,
362
362
compilation. into_dist_packagers ( path_transformer)
363
363
. map ( |packagers| ( dist_compile_cmd, packagers, dist_output_paths) )
364
364
} )
365
- . and_then ( move |( mut dist_compile_cmd, ( inputs_packager, toolchain_packager) , dist_output_paths) | {
365
+ . and_then ( move |( mut dist_compile_cmd, ( inputs_packager, toolchain_packager, outputs_rewriter ) , dist_output_paths) | {
366
366
debug ! ( "[{}]: Identifying dist toolchain for {:?}" , compile_out_pretty2, local_executable) ;
367
367
// TODO: put on a thread
368
368
let ( dist_toolchain, maybe_dist_compile_executable) =
@@ -404,12 +404,16 @@ fn dist_or_local_compile<T>(dist_client: Arc<dist::Client>,
404
404
dist:: RunJobResult :: JobNotFound => panic ! ( ) ,
405
405
} ;
406
406
info ! ( "fetched {:?}" , jc. outputs. iter( ) . map( |& ( ref p, ref bs) | ( p, bs. lens( ) . to_string( ) ) ) . collect:: <Vec <_>>( ) ) ;
407
+ let mut output_paths = vec ! [ ] ;
407
408
for ( path, output_data) in jc. outputs {
408
409
let len = output_data. lens ( ) . actual ;
409
- let mut file = File :: create ( path_transformer. to_local ( & path) ) . unwrap ( ) ;
410
+ let local_path = path_transformer. to_local ( & path) ;
411
+ let mut file = File :: create ( & local_path) . unwrap ( ) ;
410
412
let count = io:: copy ( & mut output_data. into_reader ( ) , & mut file) . unwrap ( ) ;
411
413
assert ! ( count == len) ;
414
+ output_paths. push ( ( path, local_path) )
412
415
}
416
+ outputs_rewriter. handle_outputs ( & path_transformer, output_paths) . unwrap ( ) ;
413
417
jc. output . into ( )
414
418
} )
415
419
)
@@ -439,7 +443,7 @@ pub trait Compilation {
439
443
/// Create a function that will create the inputs used to perform a distributed compilation
440
444
#[ cfg( feature = "dist-client" ) ]
441
445
fn into_dist_packagers ( self : Box < Self > , _path_transformer : dist:: PathTransformer )
442
- -> Result < ( Box < pkg:: InputsPackager > , Box < pkg:: ToolchainPackager > ) > {
446
+ -> Result < ( Box < pkg:: InputsPackager > , Box < pkg:: ToolchainPackager > , Box < OutputsRewriter > ) > {
443
447
444
448
bail ! ( "distributed compilation not implemented" )
445
449
}
@@ -451,6 +455,22 @@ pub trait Compilation {
451
455
fn outputs < ' a > ( & ' a self ) -> Box < Iterator < Item =( & ' a str , & ' a Path ) > + ' a > ;
452
456
}
453
457
458
+ #[ cfg( feature = "dist-client" ) ]
459
+ pub trait OutputsRewriter {
460
+ fn handle_outputs ( self : Box < Self > , path_transformer : & dist:: PathTransformer , output_paths : Vec < ( String , PathBuf ) > )
461
+ -> Result < ( ) > ;
462
+ }
463
+
464
+ #[ cfg( feature = "dist-client" ) ]
465
+ pub struct NoopOutputsRewriter ;
466
+ #[ cfg( feature = "dist-client" ) ]
467
+ impl OutputsRewriter for NoopOutputsRewriter {
468
+ fn handle_outputs ( self : Box < Self > , _path_transformer : & dist:: PathTransformer , _output_paths : Vec < ( String , PathBuf ) > )
469
+ -> Result < ( ) > {
470
+ Ok ( ( ) )
471
+ }
472
+ }
473
+
454
474
/// Result of generating a hash from a compiler command.
455
475
pub struct HashResult {
456
476
/// The hash key of the inputs.
0 commit comments