message: Expose `Target` and `Unit` params to appropriate `Executor` callbacks
diff: @@ -66,11 +66,18 @@ pub type PackagesToBuild<'a> = [(&'a Package, Vec<(&'a Target, &'a Profile)>)];
  /// directly, we'll use an Executor, giving clients an opportunity to intercept
  /// the build calls.
  pub trait Executor: Send + Sync + 'static {
  - fn init(&self, _cx: &Context) {}
  -
  - /// If execution succeeds, the ContinueBuild value indicates whether Cargo
  - /// should continue with the build process for this package.
  - fn exec(&self, cmd: ProcessBuilder, _id: &PackageId) -> CargoResult<()> {
  + /// Called after a rustc process invocation is prepared up-front for a given
  + /// unit of work (may still be modified for runtime-known dependencies, when
  + /// the work is actually executed).
  + fn init(&self, _cx: &Context, _unit: &Unit) {}
  +
  + /// In case of an `Err`, Cargo will not continue with the build process for
  + /// this package.
  + fn exec(&self,
  + cmd: ProcessBuilder,
  + _id: &PackageId,
  + _target: &Target)
  + -> CargoResult<()> {
  cmd.exec()?;
  Ok(())
  }
  @@ -78,6 +85,7 @@ pub trait Executor: Send + Sync + 'static {
  fn exec_json(&self,
  cmd: ProcessBuilder,
  _id: &PackageId,
  + _target: &Target,
  handle_stdout: &mut FnMut(&str) -> CargoResult<()>,
  handle_stderr: &mut FnMut(&str) -> CargoResult<()>)
  -> CargoResult<()> {
  @@ -315,7 +323,7 @@ fn rustc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
  let package_id = unit.pkg.package_id().clone();
  let target = unit.target.clone();
  - exec.init(cx);
  + exec.init(cx, &unit);
  let exec = exec.clone();
  let root_output = cx.target_root().to_path_buf();
  @@ -358,7 +366,7 @@ fn rustc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
  state.running(&rustc);
  if json_messages {
  - exec.exec_json(rustc, &package_id,
  + exec.exec_json(rustc, &package_id, &target,
  &mut |line| if !line.is_empty() {
  Err(internal(&format!("compiler stdout is not empty: `{}`", line)))
  } else {
  @@ -387,7 +395,7 @@ fn rustc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>,
  format!("Could not compile `{}`.", name)
  })?;
  } else {
  - exec.exec(rustc, &package_id).map_err(|e| e.into_internal()).chain_err(|| {
  + exec.exec(rustc, &package_id, &target).map_err(|e| e.into_internal()).chain_err(|| {
  format!("Could not compile `{}`.", name)
  })?;
  }
  