Skip to content

Commit 70bd3aa

Browse files
chore: Improve the output of dfx build and dfx generate (#4123)
* Make 'dfx build' output the names of the canisters that were built. * Make the output of 'dfx generate' more readable. * Add the e2e test. * Update changelog. * Fixed the merging issue of changelog file. * Addressed review comments.
1 parent 5f88b14 commit 70bd3aa

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ Running a local replica is still possible with `--replica`, but this option will
1313

1414
Updated the canister creation fee to `500B` cycles as [documented](https://internetcomputer.org/docs/building-apps/essentials/gas-cost#cycles-price-breakdown).
1515

16+
### chore: improve the `dfx build` output.
17+
18+
Improve the ouput of `dfx build` with the canister names that were built, example as below.
19+
20+
```
21+
$ dfx build
22+
Building canister 'hello_backend'.
23+
Building canister 'hello_frontend'.
24+
Finished building canisters.
25+
```
26+
1627
# 0.25.1
1728

1829
### feat: `skip_cargo_audit` flag in dfx.json to skip `cargo audit` build step

e2e/tests-dfx/build.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ teardown() {
150150
dfx_start
151151
dfx canister create --all
152152
assert_command dfx build
153+
assert_contains "Building canister 'e2e_project_backend'"
154+
assert_contains "Finished building canisters."
153155
}
154156

155157
@test "build succeeds if enable optimize" {

src/dfx/src/commands/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ pub fn exec(env: &dyn Environment, opts: CanisterBuildOpts) -> DfxResult {
8282
}
8383
}
8484

85-
slog::info!(logger, "Building canisters...");
86-
8785
let runtime = Runtime::new().expect("Unable to create a runtime");
8886
let build_config = BuildConfig::from_config(&config)?
8987
.with_canisters_to_build(canisters_to_build)
9088
.with_env_file(env_file);
9189
runtime.block_on(canister_pool.build_or_fail(&env, logger, &build_config))?;
9290

91+
slog::info!(logger, "Finished building canisters.");
92+
9393
Ok(())
9494
}

src/dfx/src/lib/builders/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub trait CanisterBuilder {
217217
spinner.finish_and_clear();
218218
info!(
219219
logger,
220-
"Generated type declarations for canister {} to {}",
220+
"Generated type declarations for canister '{}' to '{}'",
221221
&info.get_name(),
222222
generate_output_dir.display()
223223
);

src/dfx/src/lib/models/canister.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ impl CanisterPool {
792792
.map(|c| c.get_name())
793793
.contains(&canister.get_name())
794794
{
795-
trace!(log, "Building canister '{}'.", canister.get_name());
795+
info!(log, "Building canister '{}'.", canister.get_name());
796796
} else {
797797
trace!(log, "Not building canister '{}'.", canister.get_name());
798798
continue;

0 commit comments

Comments
 (0)