From 714a64549bdb0bbf0f2374a0eddfde47184fdaea Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Fri, 8 Dec 2023 23:05:13 -0500 Subject: [PATCH] Use a progress bar for the build phase (#597) I think this might've been an oversight when copying over the build reporting during the source distribution refactor. --- crates/puffin-cli/src/commands/reporters.rs | 23 +++++++++------------ crates/puffin-distribution/src/download.rs | 8 ++----- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/crates/puffin-cli/src/commands/reporters.rs b/crates/puffin-cli/src/commands/reporters.rs index bec53a7fb..ac5822ed9 100644 --- a/crates/puffin-cli/src/commands/reporters.rs +++ b/crates/puffin-cli/src/commands/reporters.rs @@ -95,13 +95,10 @@ impl From for FetcherReporter { let multi_progress = MultiProgress::with_draw_target(printer.target()); let progress = multi_progress.add(ProgressBar::with_draw_target(None, printer.target())); - progress.enable_steady_tick(Duration::from_millis(200)); progress.set_style( - ProgressStyle::with_template("{spinner:.white} {wide_msg:.dim}") - .unwrap() - .tick_strings(&["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]), + ProgressStyle::with_template("{bar:20} [{pos}/{len}] {wide_msg:.dim}").unwrap(), ); - progress.set_message("Resolving dependencies..."); + progress.set_message("Fetching packages..."); Self { printer, @@ -135,7 +132,7 @@ impl puffin_distribution::Reporter for FetcherReporter { progress.set_style(ProgressStyle::with_template("{wide_msg}").unwrap()); progress.set_message(format!( "{} {}", - "Building".bold().green(), + "Building".bold().cyan(), dist.to_color_string() )); @@ -148,7 +145,7 @@ impl puffin_distribution::Reporter for FetcherReporter { let bars = self.bars.lock().unwrap(); let progress = &bars[index]; progress.finish_with_message(format!( - "{} {}", + " {} {}", "Built".bold().green(), dist.to_color_string() )); @@ -167,7 +164,7 @@ impl puffin_distribution::Reporter for FetcherReporter { progress.set_style(ProgressStyle::with_template("{wide_msg}").unwrap()); progress.set_message(format!( "{} {} ({})", - "Updating".bold().green(), + "Updating".bold().cyan(), url, rev.dimmed() )); @@ -182,7 +179,7 @@ impl puffin_distribution::Reporter for FetcherReporter { let bars = self.bars.lock().unwrap(); let progress = &bars[index]; progress.finish_with_message(format!( - "{} {} ({})", + " {} {} ({})", "Updated".bold().green(), url, rev.dimmed() @@ -298,7 +295,7 @@ impl puffin_resolver::ResolverReporter for ResolverReporter { progress.set_style(ProgressStyle::with_template("{wide_msg}").unwrap()); progress.set_message(format!( "{} {}", - "Building".bold().green(), + "Building".bold().cyan(), dist.to_color_string() )); @@ -311,7 +308,7 @@ impl puffin_resolver::ResolverReporter for ResolverReporter { let bars = self.bars.lock().unwrap(); let progress = &bars[index]; progress.finish_with_message(format!( - "{} {}", + " {} {}", "Built".bold().green(), dist.to_color_string() )); @@ -330,7 +327,7 @@ impl puffin_resolver::ResolverReporter for ResolverReporter { progress.set_style(ProgressStyle::with_template("{wide_msg}").unwrap()); progress.set_message(format!( "{} {} ({})", - "Updating".bold().green(), + "Updating".bold().cyan(), url, rev.dimmed() )); @@ -345,7 +342,7 @@ impl puffin_resolver::ResolverReporter for ResolverReporter { let bars = self.bars.lock().unwrap(); let progress = &bars[index]; progress.finish_with_message(format!( - "{} {} ({})", + " {} {} ({})", "Updated".bold().green(), url, rev.dimmed() diff --git a/crates/puffin-distribution/src/download.rs b/crates/puffin-distribution/src/download.rs index 2f89699af..c115704b0 100644 --- a/crates/puffin-distribution/src/download.rs +++ b/crates/puffin-distribution/src/download.rs @@ -116,17 +116,13 @@ impl std::fmt::Display for Download { impl std::fmt::Display for LocalWheel { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - LocalWheel::InMemory(wheel) => write!(f, "{} from {}", wheel.filename, wheel.dist), - LocalWheel::Disk(wheel) => write!(f, "{} from {}", wheel.filename, wheel.dist), - LocalWheel::Built(wheel) => write!(f, "{} from {}", wheel.filename, wheel.dist), - } + write!(f, "{}", self.remote()) } } impl std::fmt::Display for SourceDistDownload { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.dist) + write!(f, "{}", self.remote()) } }