aboutsummaryrefslogtreecommitdiff
path: root/build/test/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-07-21 16:21:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-07-21 16:21:07 +0200
commita1cec9e0df14f3c1a833e2a447b5324ff9c430d3 (patch)
treee61c7e1cb3fa27ba435053761f5a2a3fb670f728 /build/test/rule.cxx
parentbead742dbac51088e89cdd4dd7a55aaa1d8c98d7 (diff)
Test module genesis
Diffstat (limited to 'build/test/rule.cxx')
-rw-r--r--build/test/rule.cxx49
1 files changed, 49 insertions, 0 deletions
diff --git a/build/test/rule.cxx b/build/test/rule.cxx
new file mode 100644
index 0000000..3fd3a16
--- /dev/null
+++ b/build/test/rule.cxx
@@ -0,0 +1,49 @@
+// file : build/test/rule.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <build/test/rule>
+
+#include <build/scope>
+#include <build/target>
+#include <build/algorithm>
+#include <build/diagnostics>
+
+using namespace std;
+
+namespace build
+{
+ namespace test
+ {
+ match_result rule::
+ match (action a, target& t, const std::string&) const
+ {
+ // First determine if this is a test.
+ //
+ auto v (t.vars["test"]);
+
+ if (!v)
+ v.rebind (t.base_scope ()[string("test.") + t.type ().name]);
+
+ if (!v || !v.as<bool> ())
+ return match_result (t, false); // "Not a test" result.
+
+ // If this is the update pre-operation, make someone else do
+ // the job.
+ //
+ if (a.operation () != test_id)
+ return nullptr;
+
+ return match_result (t, true);
+ }
+
+ recipe rule::
+ apply (action, target&, const match_result& mr) const
+ {
+ if (!mr.value) // Not a test.
+ return noop_recipe;
+
+ return noop_recipe; //@@ TMP
+ }
+ }
+}