Skip to content

Commit 1239a21

Browse files
authored
Merge pull request #2994 from itowlson/build-multi-step-feedback
Clearer progress info for multi-command builds
2 parents c048e12 + 8d54391 commit 1239a21

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

crates/build/src/lib.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,31 @@ fn build_components(
8181
fn build_component(build_info: ComponentBuildInfo, app_dir: &Path) -> Result<()> {
8282
match build_info.build {
8383
Some(b) => {
84-
for command in b.commands() {
85-
terminal::step!("Building", "component {} with `{}`", build_info.id, command);
84+
let command_count = b.commands().len();
85+
86+
if command_count > 1 {
87+
terminal::step!(
88+
"Building",
89+
"component {} ({} commands)",
90+
build_info.id,
91+
command_count
92+
);
93+
}
94+
95+
for (index, command) in b.commands().enumerate() {
96+
if command_count > 1 {
97+
terminal::step!(
98+
"Running build step",
99+
"{}/{} for component {} with '{}'",
100+
index + 1,
101+
command_count,
102+
build_info.id,
103+
command
104+
);
105+
} else {
106+
terminal::step!("Building", "component {} with `{}`", build_info.id, command);
107+
}
108+
86109
let workdir = construct_workdir(app_dir, b.workdir.as_ref())?;
87110
if b.workdir.is_some() {
88111
println!("Working directory: {}", quoted_path(&workdir));

crates/manifest/src/schema/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub struct ComponentBuildConfig {
9494

9595
impl ComponentBuildConfig {
9696
/// The commands to execute for the build
97-
pub fn commands(&self) -> impl Iterator<Item = &String> {
97+
pub fn commands(&self) -> impl ExactSizeIterator<Item = &String> {
9898
let as_vec = match &self.command {
9999
Commands::Single(cmd) => vec![cmd],
100100
Commands::Multiple(cmds) => cmds.iter().collect(),

0 commit comments

Comments
 (0)