From 1450a0f1466a8cfb48ed17ea07beff7f0c4b4a02 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 4 Feb 2025 09:40:22 +0200 Subject: Improve progress diagnostics --- libbuild2/diagnostics.cxx | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'libbuild2/diagnostics.cxx') diff --git a/libbuild2/diagnostics.cxx b/libbuild2/diagnostics.cxx index e22ef44..091d6e5 100644 --- a/libbuild2/diagnostics.cxx +++ b/libbuild2/diagnostics.cxx @@ -930,11 +930,15 @@ namespace build2 // diag_do(), etc. // string - diag_do (context& ctx, const action&) + diag_do (context& ctx, const action& a) { const meta_operation_info& m (*ctx.current_mif); const operation_info& io (*ctx.current_inner_oif); - const operation_info* oo (ctx.current_outer_oif); + const operation_info* oo (a.outer () ? ctx.current_outer_oif : nullptr); + + assert (m.id == a.meta_operation () && + io.id == a.operation () && + (a.inner () || (oo != nullptr && oo->id == a.outer_operation ()))); string r; @@ -971,11 +975,15 @@ namespace build2 } string - diag_doing (context& ctx, const action&) + diag_doing (context& ctx, const action& a) { const meta_operation_info& m (*ctx.current_mif); const operation_info& io (*ctx.current_inner_oif); - const operation_info* oo (ctx.current_outer_oif); + const operation_info* oo (a.outer () ? ctx.current_outer_oif : nullptr); + + assert (m.id == a.meta_operation () && + io.id == a.operation () && + (a.inner () || (oo != nullptr && oo->id == a.outer_operation ()))); string r; @@ -1008,11 +1016,15 @@ namespace build2 } string - diag_did (context& ctx, const action&) + diag_did (context& ctx, const action& a) { const meta_operation_info& m (*ctx.current_mif); const operation_info& io (*ctx.current_inner_oif); - const operation_info* oo (ctx.current_outer_oif); + const operation_info* oo (a.outer () ? ctx.current_outer_oif : nullptr); + + assert (m.id == a.meta_operation () && + io.id == a.operation () && + (a.inner () || (oo != nullptr && oo->id == a.outer_operation ()))); string r; @@ -1049,11 +1061,17 @@ namespace build2 } void - diag_done (ostream& os, const action&, const target& t) + diag_done (ostream& os, const action& a, const target& t) { - const meta_operation_info& m (*t.ctx.current_mif); - const operation_info& io (*t.ctx.current_inner_oif); - const operation_info* oo (t.ctx.current_outer_oif); + context& ctx (t.ctx); + + const meta_operation_info& m (*ctx.current_mif); + const operation_info& io (*ctx.current_inner_oif); + const operation_info* oo (a.outer () ? ctx.current_outer_oif : nullptr); + + assert (m.id == a.meta_operation () && + io.id == a.operation () && + (a.inner () || (oo != nullptr && oo->id == a.outer_operation ()))); // perform(update(x)) -> "x is up to date" // configure(update(x)) -> "updating x is configured" -- cgit v1.1