mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
parent
b0679d55af
commit
e7fb2466a6
@ -34,7 +34,6 @@ Available unstable (nightly-only) flags:
|
|||||||
-Z offline -- Offline mode that does not perform network requests
|
-Z offline -- Offline mode that does not perform network requests
|
||||||
-Z unstable-options -- Allow the usage of unstable options such as --registry
|
-Z unstable-options -- Allow the usage of unstable options such as --registry
|
||||||
-Z config-profile -- Read profiles from .cargo/config files
|
-Z config-profile -- Read profiles from .cargo/config files
|
||||||
-Z compile-progress -- Display a progress bar while compiling
|
|
||||||
|
|
||||||
Run with 'cargo -Z [FLAG] [SUBCOMMAND]'"
|
Run with 'cargo -Z [FLAG] [SUBCOMMAND]'"
|
||||||
);
|
);
|
||||||
|
@ -237,9 +237,6 @@ impl<'a> JobQueue<'a> {
|
|||||||
// currently a pretty big task. This is issue #5695.
|
// currently a pretty big task. This is issue #5695.
|
||||||
let mut error = None;
|
let mut error = None;
|
||||||
let mut progress = Progress::with_style("Building", ProgressStyle::Ratio, cx.bcx.config);
|
let mut progress = Progress::with_style("Building", ProgressStyle::Ratio, cx.bcx.config);
|
||||||
if !cx.bcx.config.cli_unstable().compile_progress {
|
|
||||||
progress.disable();
|
|
||||||
}
|
|
||||||
let total = self.queue.len();
|
let total = self.queue.len();
|
||||||
loop {
|
loop {
|
||||||
// Dequeue as much work as we can, learning about everything
|
// Dequeue as much work as we can, learning about everything
|
||||||
|
@ -10,7 +10,6 @@ use serde_json;
|
|||||||
|
|
||||||
use core::manifest::TargetSourcePath;
|
use core::manifest::TargetSourcePath;
|
||||||
use core::profiles::{Lto, Profile};
|
use core::profiles::{Lto, Profile};
|
||||||
use core::shell::ColorChoice;
|
|
||||||
use core::{PackageId, Target};
|
use core::{PackageId, Target};
|
||||||
use util::errors::{CargoResult, CargoResultExt, Internal};
|
use util::errors::{CargoResult, CargoResultExt, Internal};
|
||||||
use util::paths;
|
use util::paths;
|
||||||
@ -241,8 +240,6 @@ fn rustc<'a, 'cfg>(
|
|||||||
.unwrap_or_else(|| cx.bcx.config.cwd())
|
.unwrap_or_else(|| cx.bcx.config.cwd())
|
||||||
.to_path_buf();
|
.to_path_buf();
|
||||||
|
|
||||||
let should_capture_output = cx.bcx.config.cli_unstable().compile_progress;
|
|
||||||
|
|
||||||
return Ok(Work::new(move |state| {
|
return Ok(Work::new(move |state| {
|
||||||
// Only at runtime have we discovered what the extra -L and -l
|
// Only at runtime have we discovered what the extra -L and -l
|
||||||
// arguments are for native libraries, so we process those here. We
|
// arguments are for native libraries, so we process those here. We
|
||||||
@ -292,12 +289,7 @@ fn rustc<'a, 'cfg>(
|
|||||||
} else if build_plan {
|
} else if build_plan {
|
||||||
state.build_plan(buildkey, rustc.clone(), outputs.clone());
|
state.build_plan(buildkey, rustc.clone(), outputs.clone());
|
||||||
} else {
|
} else {
|
||||||
let exec_result = if should_capture_output {
|
exec.exec_and_capture_output(rustc, &package_id, &target, mode, state)
|
||||||
exec.exec_and_capture_output(rustc, &package_id, &target, mode, state)
|
|
||||||
} else {
|
|
||||||
exec.exec(rustc, &package_id, &target, mode)
|
|
||||||
};
|
|
||||||
exec_result
|
|
||||||
.map_err(Internal::new)
|
.map_err(Internal::new)
|
||||||
.chain_err(|| format!("Could not compile `{}`.", name))?;
|
.chain_err(|| format!("Could not compile `{}`.", name))?;
|
||||||
}
|
}
|
||||||
@ -629,8 +621,6 @@ fn rustdoc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoResult
|
|||||||
let package_id = unit.pkg.package_id().clone();
|
let package_id = unit.pkg.package_id().clone();
|
||||||
let target = unit.target.clone();
|
let target = unit.target.clone();
|
||||||
|
|
||||||
let should_capture_output = cx.bcx.config.cli_unstable().compile_progress;
|
|
||||||
|
|
||||||
Ok(Work::new(move |state| {
|
Ok(Work::new(move |state| {
|
||||||
if let Some(output) = build_state.outputs.lock().unwrap().get(&key) {
|
if let Some(output) = build_state.outputs.lock().unwrap().get(&key) {
|
||||||
for cfg in output.cfgs.iter() {
|
for cfg in output.cfgs.iter() {
|
||||||
@ -649,10 +639,8 @@ fn rustdoc<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoResult
|
|||||||
&mut |line| json_stderr(line, &package_id, &target),
|
&mut |line| json_stderr(line, &package_id, &target),
|
||||||
false,
|
false,
|
||||||
).map(drop)
|
).map(drop)
|
||||||
} else if should_capture_output {
|
|
||||||
state.capture_output(&rustdoc, false).map(drop)
|
|
||||||
} else {
|
} else {
|
||||||
rustdoc.exec()
|
state.capture_output(&rustdoc, false).map(drop)
|
||||||
};
|
};
|
||||||
exec_result.chain_err(|| format!("Could not document `{}`.", name))?;
|
exec_result.chain_err(|| format!("Could not document `{}`.", name))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -709,12 +697,9 @@ fn add_cap_lints(bcx: &BuildContext, unit: &Unit, cmd: &mut ProcessBuilder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn add_color(bcx: &BuildContext, cmd: &mut ProcessBuilder) {
|
fn add_color(bcx: &BuildContext, cmd: &mut ProcessBuilder) {
|
||||||
let capture_output = bcx.config.cli_unstable().compile_progress;
|
|
||||||
let shell = bcx.config.shell();
|
let shell = bcx.config.shell();
|
||||||
if capture_output || shell.color_choice() != ColorChoice::CargoAuto {
|
let color = if shell.supports_color() { "always" } else { "never" };
|
||||||
let color = if shell.supports_color() { "always" } else { "never" };
|
cmd.args(&["--color", color]);
|
||||||
cmd.args(&["--color", color]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_error_format(bcx: &BuildContext, cmd: &mut ProcessBuilder) {
|
fn add_error_format(bcx: &BuildContext, cmd: &mut ProcessBuilder) {
|
||||||
|
@ -318,7 +318,6 @@ pub struct CliUnstable {
|
|||||||
pub package_features: bool,
|
pub package_features: bool,
|
||||||
pub advanced_env: bool,
|
pub advanced_env: bool,
|
||||||
pub config_profile: bool,
|
pub config_profile: bool,
|
||||||
pub compile_progress: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CliUnstable {
|
impl CliUnstable {
|
||||||
@ -355,7 +354,6 @@ impl CliUnstable {
|
|||||||
"package-features" => self.package_features = true,
|
"package-features" => self.package_features = true,
|
||||||
"advanced-env" => self.advanced_env = true,
|
"advanced-env" => self.advanced_env = true,
|
||||||
"config-profile" => self.config_profile = true,
|
"config-profile" => self.config_profile = true,
|
||||||
"compile-progress" => self.compile_progress = true,
|
|
||||||
_ => bail!("unknown `-Z` flag specified: {}", k),
|
_ => bail!("unknown `-Z` flag specified: {}", k),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,22 +294,6 @@ Example:
|
|||||||
cargo +nightly build --build-plan -Z unstable-options
|
cargo +nightly build --build-plan -Z unstable-options
|
||||||
```
|
```
|
||||||
|
|
||||||
### Compile progress
|
|
||||||
* Tracking Issue: [rust-lang/cargo#2536](https://github.com/rust-lang/cargo/issues/2536)
|
|
||||||
|
|
||||||
The `-Z compile-progress` flag enables a progress bar while compiling.
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ cargo +nightly build -Z compile-progress
|
|
||||||
Compiling libc v0.2.41
|
|
||||||
Compiling void v1.0.2
|
|
||||||
Compiling lazy_static v1.0.1
|
|
||||||
Compiling regex v1.0.0
|
|
||||||
Compiling ucd-util v0.1.1
|
|
||||||
Compiling utf8-ranges v1.0.0
|
|
||||||
Building [=======> ] 2/14: libc, regex, uc...
|
|
||||||
```
|
|
||||||
|
|
||||||
### default-run
|
### default-run
|
||||||
* Original issue: [#2200](https://github.com/rust-lang/cargo/issues/2200)
|
* Original issue: [#2200](https://github.com/rust-lang/cargo/issues/2200)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user