aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-17 10:50:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-17 10:50:57 +0200
commit78d21f22eb72a96d9e993e358743ed72349e4235 (patch)
tree7cbc4c200f23b0fba3d92f535f57463e0539ae63
parentf9d759160eef1ca870edcbb9b87caa23f0c93a43 (diff)
Fix few issues with structured result output
-rw-r--r--build2/b-options.cxx4
-rw-r--r--build2/b.cli4
-rw-r--r--build2/b.cxx8
-rw-r--r--build2/config/operation.cxx4
-rw-r--r--build2/dist/operation.cxx11
-rw-r--r--build2/operation.cxx6
-rw-r--r--build2/operation.hxx4
7 files changed, 23 insertions, 18 deletions
diff --git a/build2/b-options.cxx b/build2/b-options.cxx
index 6205bfa..f3a15c3 100644
--- a/build2/b-options.cxx
+++ b/build2/b-options.cxx
@@ -748,8 +748,8 @@ namespace build2
<< " If the action is a pre or post operation, then the outer" << ::std::endl
<< " operation is specified in parenthesis. For example:" << ::std::endl
<< ::std::endl
- << " unchanged perform update(test) dir{./}" << ::std::endl
- << " changed perform test dir{./}" << ::std::endl
+ << " unchanged perform update(test) /tmp/dir{hello/}" << ::std::endl
+ << " changed perform test /tmp/dir{hello/}" << ::std::endl
<< ::std::endl
<< " Currently only the \033[1mperform\033[0m meta-operation supports the" << ::std::endl
<< " structured result output." << ::std::endl;
diff --git a/build2/b.cli b/build2/b.cli
index d7634c0..64fd852 100644
--- a/build2/b.cli
+++ b/build2/b.cli
@@ -439,8 +439,8 @@ namespace build2
outer operation is specified in parenthesis. For example:
\
- unchanged perform update(test) dir{./}
- changed perform test dir{./}
+ unchanged perform update(test) /tmp/dir{hello/}
+ changed perform test /tmp/dir{hello/}
\
Currently only the \cb{perform} meta-operation supports the structured
diff --git a/build2/b.cxx b/build2/b.cxx
index 7bb9484..f6ee45a 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -1187,6 +1187,8 @@ main (int argc, char* argv[])
// Finally, match the rules and perform the operation.
//
+ bool sr ();
+
if (pre_oid != 0)
{
l5 ([&]{trace << "start pre-operation batch " << pre_oif->name
@@ -1203,7 +1205,7 @@ main (int argc, char* argv[])
result_printer p (tgs);
if (mif->match != nullptr)
- mif->match (mparams, a, tgs);
+ mif->match (mparams, a, tgs, true /* quiet */);
if (mif->execute != nullptr && !ops.match_only ())
mif->execute (mparams, a, tgs, true /* quiet */);
@@ -1226,7 +1228,7 @@ main (int argc, char* argv[])
result_printer p (tgs);
if (mif->match != nullptr)
- mif->match (mparams, a, tgs);
+ mif->match (mparams, a, tgs, ops.structured_result () /*quiet*/);
if (mif->execute != nullptr && !ops.match_only ())
mif->execute (mparams, a, tgs, ops.structured_result () /*quiet*/);
@@ -1250,7 +1252,7 @@ main (int argc, char* argv[])
result_printer p (tgs);
if (mif->match != nullptr)
- mif->match (mparams, a, tgs);
+ mif->match (mparams, a, tgs, true /* quiet */);
if (mif->execute != nullptr && !ops.match_only ())
mif->execute (mparams, a, tgs, true /* quiet */);
diff --git a/build2/config/operation.cxx b/build2/config/operation.cxx
index c5de54f..fa7cb9f 100644
--- a/build2/config/operation.cxx
+++ b/build2/config/operation.cxx
@@ -348,7 +348,7 @@ namespace build2
}
static void
- configure_match (const values&, action, action_targets&)
+ configure_match (const values&, action, action_targets&, bool)
{
// Don't match anything -- see execute ().
}
@@ -493,7 +493,7 @@ namespace build2
}
static void
- disfigure_match (const values&, action, action_targets&)
+ disfigure_match (const values&, action, action_targets&, bool)
{
}
diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx
index 7644ba9..a378b5d 100644
--- a/build2/dist/operation.cxx
+++ b/build2/dist/operation.cxx
@@ -133,18 +133,21 @@ namespace build2
const operation_info* poif (
rs->operations[oif->pre (params, dist_id, loc)]);
set_current_oif (*poif, oif);
- match (params, action (dist_id, poif->id, oif->id), ts);
+ action a (dist_id, poif->id, oif->id);
+ match (params, a, ts, true /* quiet */);
}
set_current_oif (*oif);
- match (params, action (dist_id, oif->id), ts);
+ action a (dist_id, oif->id);
+ match (params, a, ts, true /* quiet */);
if (oif->post != nullptr)
{
const operation_info* poif (
rs->operations[oif->post (params, dist_id)]);
set_current_oif (*poif, oif);
- match (params, action (dist_id, poif->id, oif->id), ts);
+ action a (dist_id, poif->id, oif->id);
+ match (params, a, ts, true /* quiet */);
}
}
}
@@ -265,7 +268,7 @@ namespace build2
action a (perform_id, update_id);
- mo_perform.match (params, a, files);
+ mo_perform.match (params, a, files, true /* quiet */);
mo_perform.execute (params, a, files, true /* quiet */);
if (mo_perform.operation_post != nullptr)
diff --git a/build2/operation.cxx b/build2/operation.cxx
index fab5cf5..62f82d3 100644
--- a/build2/operation.cxx
+++ b/build2/operation.cxx
@@ -112,7 +112,7 @@ namespace build2
}
void
- match (const values&, action a, action_targets& ts)
+ match (const values&, action a, action_targets& ts, bool quiet)
{
tracer trace ("match");
@@ -212,7 +212,7 @@ namespace build2
// We bailed before matching it (leave state in action_target as
// unknown).
//
- if (verb != 0)
+ if (verb != 0 && !quiet)
info << "not " << diag_did (a, t);
break;
@@ -226,7 +226,7 @@ namespace build2
{
// Things didn't go well for this target.
//
- if (verb != 0)
+ if (verb != 0 && !quiet)
info << "failed to " << diag_do (a, t);
at.state = s;
diff --git a/build2/operation.hxx b/build2/operation.hxx
index c157e0a..a65fc3d 100644
--- a/build2/operation.hxx
+++ b/build2/operation.hxx
@@ -258,7 +258,7 @@ namespace build2
const location&,
action_targets&);
- void (*match) (const values&, action, action_targets&);
+ void (*match) (const values&, action, action_targets&, bool quiet);
void (*execute) (const values&, action, action_targets&, bool quiet);
@@ -299,7 +299,7 @@ namespace build2
action_targets&);
void
- match (const values&, action, action_targets&);
+ match (const values&, action, action_targets&, bool quiet);
// Execute the action on the list of targets. This is the default
// implementation that does just that while issuing appropriate