aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-18 15:39:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-18 17:30:47 +0200
commitdd008d6e48b0bb66e1b9fdc489d9d1d9b4cb8d25 (patch)
tree1270a617c1a6893d3a1f5308ecf9d1e9dbc1694e
parentaeeedd32f8717d8c6a1886a5561a879059be87d0 (diff)
Implement noop meta-operation
The effect is loading all the buildfiles but not searching/matching/executing any targets/operations. Useful for testing.
-rw-r--r--build2/b.cxx17
-rw-r--r--build2/context.cxx1
-rw-r--r--build2/file.cxx1
-rw-r--r--build2/operation10
-rw-r--r--build2/operation.cxx16
5 files changed, 33 insertions, 12 deletions
diff --git a/build2/b.cxx b/build2/b.cxx
index a652c97..4a764e6 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -927,15 +927,16 @@ main (int argc, char* argv[])
// building before we know how to for all the targets in this
// operation batch.
//
- {
- scope& bs (scopes.find (ts.out_base));
+ scope& bs (scopes.find (ts.out_base));
- const string* e;
- const target_type* ti (bs.find_target_type (tn, e));
+ const string* e;
+ const target_type* ti (bs.find_target_type (tn, e));
- if (ti == nullptr)
- fail (l) << "unknown target type " << tn.type;
+ if (ti == nullptr)
+ fail (l) << "unknown target type " << tn.type;
+ if (mif->search != nullptr)
+ {
// If the directory is relative, assume it is relative to work
// (must be consistent with how we derived out_base above).
//
@@ -986,8 +987,8 @@ main (int argc, char* argv[])
action a (mid, oid, 0);
- mif->match (a, tgs);
- mif->execute (a, tgs, verb == 0);
+ if (mif->match != nullptr) mif->match (a, tgs);
+ if (mif->execute != nullptr) mif->execute (a, tgs, verb == 0);
if (post_oid != 0)
{
diff --git a/build2/context.cxx b/build2/context.cxx
index 03e64cd..3b58b90 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -66,6 +66,7 @@ namespace build2
// constants in <build2/operation>.
//
meta_operation_table.clear ();
+ meta_operation_table.insert ("noop");
meta_operation_table.insert ("perform");
meta_operation_table.insert ("configure");
meta_operation_table.insert ("disfigure");
diff --git a/build2/file.cxx b/build2/file.cxx
index 478722f..ce9571d 100644
--- a/build2/file.cxx
+++ b/build2/file.cxx
@@ -154,6 +154,7 @@ namespace build2
//
if (first)
{
+ rs.meta_operations.insert (noop_id, noop);
rs.meta_operations.insert (perform_id, perform);
rs.operations.insert (default_id, default_);
diff --git a/build2/operation b/build2/operation
index 730a958..e04d1a3 100644
--- a/build2/operation
+++ b/build2/operation
@@ -99,10 +99,11 @@ namespace build2
// Id constants for build-in and pre-defined meta/operations.
//
- const meta_operation_id perform_id = 1;
- const meta_operation_id configure_id = 2;
- const meta_operation_id disfigure_id = 3;
- const meta_operation_id dist_id = 4;
+ const meta_operation_id noop_id = 1; // nomop?
+ const meta_operation_id perform_id = 2;
+ const meta_operation_id configure_id = 3;
+ const meta_operation_id disfigure_id = 4;
+ const meta_operation_id dist_id = 5;
// The default operation is a special marker that can be used to indicate
// that no operation was explicitly specified by the user. If adding
@@ -250,6 +251,7 @@ namespace build2
void
execute (action, const action_targets&, bool quiet);
+ extern meta_operation_info noop;
extern meta_operation_info perform;
// Operation info.
diff --git a/build2/operation.cxx b/build2/operation.cxx
index f8ce46f..57ad84b 100644
--- a/build2/operation.cxx
+++ b/build2/operation.cxx
@@ -170,6 +170,22 @@ namespace build2
}
}
+ meta_operation_info noop {
+ noop_id,
+ "noop",
+ "", // Presumably we will never need these since we are not going
+ "", // to do anything.
+ "",
+ nullptr, // meta-operation pre
+ nullptr, // operation pre
+ &load,
+ nullptr, // search
+ nullptr, // match
+ nullptr, // execute
+ nullptr, // operation post
+ nullptr // meta-operation post
+ };
+
meta_operation_info perform {
perform_id,
"perform",