Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CompileMode to Executor callbacks #5830

Merged
merged 1 commit into from
Jul 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/cargo/core/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ pub trait Executor: Send + Sync + 'static {

/// 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<()> {
fn exec(
&self,
cmd: ProcessBuilder,
_id: &PackageId,
_target: &Target,
_mode: CompileMode
) -> CargoResult<()> {
cmd.exec()?;
Ok(())
}
Expand All @@ -71,6 +77,7 @@ pub trait Executor: Send + Sync + 'static {
cmd: ProcessBuilder,
_id: &PackageId,
_target: &Target,
_mode: CompileMode,
handle_stdout: &mut FnMut(&str) -> CargoResult<()>,
handle_stderr: &mut FnMut(&str) -> CargoResult<()>,
) -> CargoResult<()> {
Expand Down Expand Up @@ -194,6 +201,7 @@ fn rustc<'a, 'cfg>(
let json_messages = cx.bcx.build_config.json_messages();
let package_id = unit.pkg.package_id().clone();
let target = unit.target.clone();
let mode = unit.mode;

exec.init(cx, unit);
let exec = exec.clone();
Expand Down Expand Up @@ -246,6 +254,7 @@ fn rustc<'a, 'cfg>(
rustc,
&package_id,
&target,
mode,
&mut |line| {
if !line.is_empty() {
Err(internal(&format!(
Expand Down Expand Up @@ -279,7 +288,7 @@ fn rustc<'a, 'cfg>(
} else if build_plan {
state.build_plan(buildkey, rustc.clone(), outputs.clone());
} else {
exec.exec(rustc, &package_id, &target)
exec.exec(rustc, &package_id, &target, mode)
.map_err(Internal::new)
.chain_err(|| format!("Could not compile `{}`.", name))?;
}
Expand Down