summaryrefslogtreecommitdiff
path: root/src/task.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/task.cc')
-rw-r--r--src/task.cc27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/task.cc b/src/task.cc
index 1c6c233..fb50765 100644
--- a/src/task.cc
+++ b/src/task.cc
@@ -6,22 +6,25 @@
#include <unistd.h>
#include <iostream>
-Task::Task(const BuildConfiguration& config)
+Task::Task(const BuildConfiguration& config, const Settings& settings,
+ const std::string& sourceDir)
: config(config)
, output_system(config.system)
+ , settings(settings)
+ , sourceDir(sourceDir)
{
}
-int Task::registerDepTasks(const std::list<std::shared_ptr<Task>>& tasks)
+int Task::registerDepTasks(const std::set<std::shared_ptr<Task>>& tasks)
{
for(const auto& depStr : depends())
{
bool found{false};
for(const auto& task : tasks)
{
- if(task->target() == depStr)
+ if(*task == depStr)
{
- dependsTasks.push_back(task);
+ dependsTasks.insert(task);
found = true;
}
}
@@ -33,12 +36,22 @@ int Task::registerDepTasks(const std::list<std::shared_ptr<Task>>& tasks)
}
}
- return 0;
+ return registerDepTasksInner(tasks);
+}
+
+bool Task::operator==(const std::string& depStr)
+{
+ return
+ name() == depStr ||
+ target() == depStr ||
+ sourceDir + "/" + target() == depStr ||
+ targetFile().string() == depStr
+ ;
}
std::string Task::name() const
{
- return config.target;
+ return config.name;
}
bool Task::dirty()
@@ -141,7 +154,7 @@ std::string Task::compiler() const
}
}
-std::list<std::shared_ptr<Task>> Task::getDependsTasks()
+std::set<std::shared_ptr<Task>> Task::getDependsTasks()
{
return dependsTasks;
}