diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-09-14 07:46:43 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-09-14 07:46:43 +0200 |
commit | ba04d2889a4e017c6043bac9951f722e60b63bc5 (patch) | |
tree | 1267f9264dfe81aadeac46446ee6122a5abe5190 /src/tasks.cc | |
parent | f7fda8ca8841552b54ce72ed8ca9156cc09368d0 (diff) |
Add suport for building and running unittests with the 'check' target.
Diffstat (limited to 'src/tasks.cc')
-rw-r--r-- | src/tasks.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/tasks.cc b/src/tasks.cc index 1607b37..3113564 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -3,6 +3,7 @@ #include <filesystem> #include <deque> #include <iostream> +#include <algorithm> #include "settings.h" #include "libctor.h" @@ -101,6 +102,7 @@ std::list<std::shared_ptr<Task>> taskFactory(const BuildConfiguration& config, break; case TargetType::Executable: + case TargetType::UnitTest: tasks.emplace_back(std::make_shared<TaskLD>(config, settings, config.target, objects)); break; @@ -111,6 +113,7 @@ std::list<std::shared_ptr<Task>> taskFactory(const BuildConfiguration& config, return tasks; } +} std::shared_ptr<Task> getNextTask(const std::list<std::shared_ptr<Task>>& allTasks, std::list<std::shared_ptr<Task>>& dirtyTasks) @@ -131,15 +134,20 @@ std::shared_ptr<Task> getNextTask(const std::list<std::shared_ptr<Task>>& allTas return nullptr; } -std::list<std::shared_ptr<Task>> getTasks(const Settings& settings) +std::list<std::shared_ptr<Task>> getTasks(const Settings& settings, + const std::vector<std::string> names) { auto& targets = getTargets(settings); std::list<std::shared_ptr<Task>> tasks; for(const auto& target : targets) { - std::vector<std::string> objects; - auto t = taskFactory(target.config, settings, target.path); - tasks.insert(tasks.end(), t.begin(), t.end()); + if(names.empty() || + std::find(std::begin(names), std::end(names), target.config.target) != std::end(names)) + { + std::vector<std::string> objects; + auto t = taskFactory(target.config, settings, target.path); + tasks.insert(tasks.end(), t.begin(), t.end()); + } } return tasks; |