summaryrefslogtreecommitdiff
path: root/src/build.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-09-14 07:46:43 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-09-14 07:46:43 +0200
commitba04d2889a4e017c6043bac9951f722e60b63bc5 (patch)
tree1267f9264dfe81aadeac46446ee6122a5abe5190 /src/build.cc
parentf7fda8ca8841552b54ce72ed8ca9156cc09368d0 (diff)
Add suport for building and running unittests with the 'check' target.
Diffstat (limited to 'src/build.cc')
-rw-r--r--src/build.cc38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/build.cc b/src/build.cc
index 445979e..4cec3b9 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -7,8 +7,6 @@
#include <set>
#include <thread>
-#include "tasks.h"
-
using namespace std::chrono_literals;
int build(const Settings& settings,
@@ -171,3 +169,39 @@ int build(const Settings& settings,
return 0;
}
+
+int build(const Settings& settings,
+ const std::string& name,
+ const std::vector<Target>& targets,
+ const std::list<std::shared_ptr<Task>>& all_tasks)
+{
+ bool task_found{false};
+ std::list<std::shared_ptr<Task>> ts;
+
+ for(const auto& target : targets)
+ {
+ for(auto task : all_tasks)
+ {
+ if(task->name() == target.config.target ||
+ task->target() == target.config.target)
+ {
+ std::cout << target.config.target << "\n";
+ task_found = true;
+
+ auto depSet = getDepTasks(task);
+ for(const auto& task : depSet)
+ {
+ ts.push_back(task);
+ }
+ }
+ }
+ }
+
+ if(!task_found)
+ {
+ std::cerr << "*** No rule to make target '" << name << "'. Stop.\n";
+ return 1;
+ }
+
+ return build(settings, name, ts, all_tasks);
+}