aboutsummaryrefslogtreecommitdiff
path: root/build/operation
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-03-24 08:53:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-03-24 08:53:06 +0200
commita94dcda7f00b10cb22b5f2138b1c29bcfbe7de37 (patch)
treec4ca2c4b2ea08285774569283120233a03aa2cb3 /build/operation
parenteaaa82bd9c1e24a83dcea3857f5fd75d0dfb6de5 (diff)
Make meta-operations control build loop; add disfigure skeleton
Diffstat (limited to 'build/operation')
-rw-r--r--build/operation67
1 files changed, 66 insertions, 1 deletions
diff --git a/build/operation b/build/operation
index 3469f21..c759d59 100644
--- a/build/operation
+++ b/build/operation
@@ -7,13 +7,19 @@
#include <string>
#include <iosfwd>
+#include <vector>
#include <cstdint>
#include <functional> // reference_wrapper
+#include <build/path>
#include <build/string-table>
namespace build
{
+ struct location;
+ class scope;
+ struct target_key;
+
// While we are using uint8_t for the meta/operation ids, we assume
// that each is limited to 4 bits (max 128 entries) so that we can
// store the combined action id in uint8_t as well. This makes our
@@ -104,17 +110,76 @@ namespace build
//
enum class execution_mode {first, last};
- // Meta/operation info.
+ // Meta-operation info.
+ //
+
+ // Normally a list of resolved and matched targets to execute. But
+ // can be something else, depending on the meta-operation.
//
+ typedef std::vector<void*> action_targets;
+
struct meta_operation_info
{
const std::string name;
+
+ void (*meta_operation_pre) (); // Start of meta-operation batch.
+ operation_id (*operation_pre) (operation_id); // Start of operation batch.
+
+ // Meta-operation-specific logic to load the buildfile, resolve and match
+ // the targets, and execute the action on the targets.
+ //
+ void (*load) (const path& buildfile,
+ scope& root,
+ const path& out_base,
+ const path& src_base,
+ const location&);
+
+ void (*match) (action,
+ const target_key&,
+ const location&,
+ action_targets&);
+
+ void (*execute) (action, const action_targets&);
+
+ void (*operation_post) (operation_id); // End of operation batch.
+ void (*meta_operation_post) (); // End of meta-operation batch.
};
// Built-in meta-operations.
//
+
+ // perform
+ //
+
+ // Load the buildfile. This is the default implementation that first
+ // calls root_pre(), then creates the scope for out_base, and, finally,
+ // loads the buildfile unless it has already been loaded for the root
+ // scope.
+ //
+ void
+ load (const path& buildfile,
+ scope& root,
+ const path& out_base,
+ const path& src_base,
+ const location&);
+
+ // Resolve and match the target. This is the default implementation
+ // that does just that and adds a pointer to the target to the list.
+ //
+ void
+ match (action, const target_key&, const location&, action_targets&);
+
+ // Execute the action on the list of targets. This is the default
+ // implementation that does just that while issuing appropriate
+ // diagnostics.
+ //
+ void
+ execute (action, const action_targets&);
+
extern meta_operation_info perform;
+ // Operation info.
+ //
struct operation_info
{
const std::string name;