@@ -66,18 +66,26 @@ pub type PackagesToBuild<'a> = [(&'a Package, Vec<(&'a Target, &'a Profile)>)];
6666/// directly, we'll use an Executor, giving clients an opportunity to intercept
6767/// the build calls.
6868pub trait Executor : Send + Sync + ' static {
69- fn init ( & self , _cx : & Context ) { }
70-
71- /// If execution succeeds, the ContinueBuild value indicates whether Cargo
72- /// should continue with the build process for this package.
73- fn exec ( & self , cmd : ProcessBuilder , _id : & PackageId ) -> CargoResult < ( ) > {
69+ /// Called after a rustc process invocation is prepared up-front for a given
70+ /// unit of work (may still be modified for runtime-known dependencies, when
71+ /// the work is actually executed).
72+ fn init ( & self , _cx : & Context , _unit : & Unit ) { }
73+
74+ /// In case of an `Err`, Cargo will not continue with the build process for
75+ /// this package.
76+ fn exec ( & self ,
77+ cmd : ProcessBuilder ,
78+ _id : & PackageId ,
79+ _target : & Target )
80+ -> CargoResult < ( ) > {
7481 cmd. exec ( ) ?;
7582 Ok ( ( ) )
7683 }
7784
7885 fn exec_json ( & self ,
7986 cmd : ProcessBuilder ,
8087 _id : & PackageId ,
88+ _target : & Target ,
8189 handle_stdout : & mut FnMut ( & str ) -> CargoResult < ( ) > ,
8290 handle_stderr : & mut FnMut ( & str ) -> CargoResult < ( ) > )
8391 -> CargoResult < ( ) > {
@@ -315,7 +323,7 @@ fn rustc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
315323 let package_id = unit. pkg . package_id ( ) . clone ( ) ;
316324 let target = unit. target . clone ( ) ;
317325
318- exec. init ( cx) ;
326+ exec. init ( cx, & unit ) ;
319327 let exec = exec. clone ( ) ;
320328
321329 let root_output = cx. target_root ( ) . to_path_buf ( ) ;
@@ -358,7 +366,7 @@ fn rustc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
358366
359367 state. running ( & rustc) ;
360368 if json_messages {
361- exec. exec_json ( rustc, & package_id,
369+ exec. exec_json ( rustc, & package_id, & target ,
362370 & mut |line| if !line. is_empty ( ) {
363371 Err ( internal ( & format ! ( "compiler stdout is not empty: `{}`" , line) ) )
364372 } else {
@@ -387,7 +395,7 @@ fn rustc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
387395 format ! ( "Could not compile `{}`." , name)
388396 } ) ?;
389397 } else {
390- exec. exec ( rustc, & package_id) . map_err ( |e| e. into_internal ( ) ) . chain_err ( || {
398+ exec. exec ( rustc, & package_id, & target ) . map_err ( |e| e. into_internal ( ) ) . chain_err ( || {
391399 format ! ( "Could not compile `{}`." , name)
392400 } ) ?;
393401 }
0 commit comments