Skip to content

Commit

Permalink
Revert "Add colors"
Browse files Browse the repository at this point in the history
This reverts commit 9fd68c9.
  • Loading branch information
jyn514 committed Jun 6, 2021
1 parent 448be39 commit 2c80938
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 36 deletions.
1 change: 0 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ dependencies = [
"pretty_assertions",
"serde",
"serde_json",
"termcolor",
"time",
"toml",
"winapi 0.3.9",
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ time = "0.1"
ignore = "0.4.10"
opener = "0.4"
merge = "0.1.0"
termcolor = "1.0"

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3"
Expand Down
27 changes: 5 additions & 22 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use std::time::{Duration, Instant};

use build_helper::{output, t};
use lazy_static::lazy_static;
use termcolor::{ColorSpec, WriteColor};

use crate::cache::{Cache, Interned, INTERNER};
use crate::check;
Expand Down Expand Up @@ -1568,7 +1567,6 @@ impl<'a> Builder<'a> {

let (out, dur) = {
let instructions = ReplicationStep {
color: self.build.config.color,
cmd: self.kind,
name: step.name(),
path: step.path(self),
Expand Down Expand Up @@ -1610,7 +1608,6 @@ impl<'a> Builder<'a> {
}

struct ReplicationStep {
color: Color,
cmd: Kind,
name: &'static str,
path: PathBuf,
Expand All @@ -1623,34 +1620,20 @@ lazy_static! {
}

pub(crate) extern "C" fn print_replication_steps() {
use std::io::Write;
if let Some(step) = CURRENT_INSTRUCTIONS.lock().expect("mutex guard is dropped on panic").take()
{
let mut stdout = termcolor::StandardStream::stdout(step.color.into());
// ignore errors; we're exiting anyway
let mut yellow = ColorSpec::new();
yellow.set_fg(Some(termcolor::Color::Yellow));
let _ = stdout.set_color(&yellow);
let _ = write!(stdout, "note");
let _ = stdout.reset();
let _ = writeln!(stdout, ": failed while building {}", step.name);

let mut blue = ColorSpec::new();
blue.set_fg(Some(termcolor::Color::Blue));
let _ = stdout.set_color(&blue);
let _ = write!(stdout, "help");
let _ = stdout.reset();
let _ = write!(
stdout,
": to replicate this failure, run `./x.py {} {} --stage {}",
println!("note: failed while building {}", step.name);
print!(
"help: to replicate this failure, run `./x.py {} {} --stage {}",
step.cmd,
step.path.display(),
step.stage,
);
for arg in step.test_args {
let _ = write!(stdout, " --test-args \"{}\"", arg);
print!(" --test-args \"{}\"", arg);
}
let _ = writeln!(stdout, "`");
println!("`");
}
}

Expand Down
12 changes: 0 additions & 12 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ use std::process;

use build_helper::t;
use getopts::Options;
use termcolor::ColorChoice;

use crate::builder::Builder;
use crate::config::{Config, TargetSelection};
use crate::setup::Profile;
use crate::{Build, DocTests};

#[derive(Copy, Clone)]
pub enum Color {
Always,
Never,
Expand All @@ -29,16 +27,6 @@ impl Default for Color {
}
}

impl From<Color> for ColorChoice {
fn from(c: Color) -> Self {
match c {
Color::Always => ColorChoice::Always,
Color::Never => ColorChoice::Never,
Color::Auto => ColorChoice::Auto,
}
}
}

impl std::str::FromStr for Color {
type Err = ();

Expand Down

0 comments on commit 2c80938

Please sign in to comment.