Skip to content

Commit

Permalink
Bring back the compile progress bar as an -Z option.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytm committed Jul 12, 2018
1 parent 15e6361 commit 6ce9087
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/bin/cargo/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Available unstable (nightly-only) flags:
-Z offline -- Offline mode that does not perform network requests
-Z unstable-options -- Allow the usage of unstable options such as --registry
-Z config-profile -- Read profiles from .cargo/config files
-Z compile-progress -- Display a progress bar while compiling
Run with 'cargo -Z [FLAG] [SUBCOMMAND]'"
);
Expand Down
4 changes: 3 additions & 1 deletion src/cargo/core/compiler/job_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ impl<'a> JobQueue<'a> {
// we're at it.
let mut error = None;
let mut progress = Progress::with_style("Building", ProgressStyle::Ratio, cx.bcx.config);
progress.disable();
if !cx.bcx.config.cli_unstable().compile_progress {
progress.disable();
}
let total = self.queue.len();
loop {
// Dequeue as much work as we can, learning about everything
Expand Down
2 changes: 2 additions & 0 deletions src/cargo/core/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ pub struct CliUnstable {
pub package_features: bool,
pub advanced_env: bool,
pub config_profile: bool,
pub compile_progress: bool,
}

impl CliUnstable {
Expand Down Expand Up @@ -347,6 +348,7 @@ impl CliUnstable {
"package-features" => self.package_features = true,
"advanced-env" => self.advanced_env = true,
"config-profile" => self.config_profile = true,
"compile-progress" => self.compile_progress = true,
_ => bail!("unknown `-Z` flag specified: {}", k),
}

Expand Down
16 changes: 16 additions & 0 deletions src/doc/src/reference/unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,19 @@ Example:
```
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...
```

0 comments on commit 6ce9087

Please sign in to comment.