From a1cec9e0df14f3c1a833e2a447b5324ff9c430d3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 21 Jul 2015 16:21:07 +0200 Subject: Test module genesis --- build/test/rule.cxx | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 build/test/rule.cxx (limited to 'build/test/rule.cxx') 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 + +#include +#include +#include +#include + +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 ()) + 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 + } + } +} -- cgit v1.1