aboutsummaryrefslogtreecommitdiff
path: root/build2/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-27 18:40:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-27 18:40:52 +0200
commit566bcb8c4c36d12e398f00349c5f27cae06fa7a9 (patch)
treed7090693a6f13cf4995a24724675faa8a5582296 /build2/context.cxx
parentd14d3123c7cdb53a635d4be55902c09a410c28cc (diff)
Implement displaying build progress (--progress|-p)
Diffstat (limited to 'build2/context.cxx')
-rw-r--r--build2/context.cxx83
1 files changed, 63 insertions, 20 deletions
diff --git a/build2/context.cxx b/build2/context.cxx
index 669fcae..2464973 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -197,6 +197,7 @@ namespace build2
execution_mode current_mode;
atomic_count dependency_count;
+ atomic_count target_count;
bool keep_going = false;
@@ -576,81 +577,123 @@ namespace build2
// diag_do(), etc.
//
- void
- diag_do (ostream& os, const action&, const target& t)
+ string
+ diag_do (const action&)
{
const meta_operation_info& m (*current_mif);
const operation_info& io (*current_inner_oif);
const operation_info* oo (current_outer_oif);
+ string r;
+
// perform(update(x)) -> "update x"
// configure(update(x)) -> "configure updating x"
//
if (m.name_do.empty ())
- os << io.name_do << ' ';
+ r = io.name_do;
else
{
- os << m.name_do << ' ';
+ r = m.name_do;
if (!io.name_doing.empty ())
- os << io.name_doing << ' ';
+ {
+ r += ' ';
+ r += io.name_doing;
+ }
}
if (oo != nullptr)
- os << "(for " << oo->name << ") ";
+ {
+ r += " (for ";
+ r += oo->name;
+ r += ')';
+ }
- os << t;
+ return r;
}
void
- diag_doing (ostream& os, const action&, const target& t)
+ diag_do (ostream& os, const action& a, const target& t)
+ {
+ os << diag_do (a) << ' ' << t;
+ }
+
+ string
+ diag_doing (const action&)
{
const meta_operation_info& m (*current_mif);
const operation_info& io (*current_inner_oif);
const operation_info* oo (current_outer_oif);
+ string r;
+
// perform(update(x)) -> "updating x"
// configure(update(x)) -> "configuring updating x"
//
if (!m.name_doing.empty ())
- os << m.name_doing << ' ';
+ r = m.name_doing;
if (!io.name_doing.empty ())
- os << io.name_doing << ' ';
+ {
+ if (!r.empty ()) r += ' ';
+ r += io.name_doing;
+ }
if (oo != nullptr)
- os << "(for " << oo->name << ") ";
+ {
+ r += " (for ";
+ r += oo->name;
+ r += ')';
+ }
- os << t;
+ return r;
}
void
- diag_did (ostream& os, const action&, const target& t)
+ diag_doing (ostream& os, const action& a, const target& t)
+ {
+ os << diag_doing (a) << ' ' << t;
+ }
+
+ string
+ diag_did (const action&)
{
const meta_operation_info& m (*current_mif);
const operation_info& io (*current_inner_oif);
const operation_info* oo (current_outer_oif);
+ string r;
+
// perform(update(x)) -> "updated x"
// configure(update(x)) -> "configured updating x"
//
if (!m.name_did.empty ())
{
- os << m.name_did << ' ';
+ r = m.name_did;
if (!io.name_doing.empty ())
- os << io.name_doing << ' ';
+ {
+ r += ' ';
+ r += io.name_doing;
+ }
}
else
+ r += io.name_did;
+
+ if (oo != nullptr)
{
- if (!io.name_did.empty ())
- os << io.name_did << ' ';
+ r += " (for ";
+ r += oo->name;
+ r += ')';
}
- if (oo != nullptr)
- os << "(for " << oo->name << ") ";
+ return r;
+ }
- os << t;
+ void
+ diag_did (ostream& os, const action& a, const target& t)
+ {
+ os << diag_did (a) << ' ' << t;
}
void