summaryrefslogtreecommitdiff
path: root/src/task.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2024-10-02 21:20:40 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2024-10-03 12:06:38 +0200
commit0008920eed996009068fe9f71512c436577b6220 (patch)
tree60350de98747a63e1739841b966269f5e312b9ba /src/task.cc
parenta38c6682e4fb1f45aa1f37d10c2480aa517ea3bc (diff)
Ensure the initial task order is preserved. Fixes bad ordering during linking.develop
Diffstat (limited to 'src/task.cc')
-rw-r--r--src/task.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/task.cc b/src/task.cc
index 817ee3a..7813235 100644
--- a/src/task.cc
+++ b/src/task.cc
@@ -5,6 +5,7 @@
#include <unistd.h>
#include <iostream>
+#include <algorithm>
Task::Task(const ctor::build_configuration& config, const ctor::settings& settings,
const std::string& sourceDir)
@@ -15,7 +16,7 @@ Task::Task(const ctor::build_configuration& config, const ctor::settings& settin
{
}
-int Task::registerDepTasks(const std::set<std::shared_ptr<Task>>& tasks)
+int Task::registerDepTasks(const std::vector<std::shared_ptr<Task>>& tasks)
{
for(const auto& depStr : depends())
{
@@ -24,7 +25,10 @@ int Task::registerDepTasks(const std::set<std::shared_ptr<Task>>& tasks)
{
if(*task == depStr)
{
- dependsTasks.insert(task);
+ if(std::find(dependsTasks.begin(), dependsTasks.end(), task) == dependsTasks.end())
+ {
+ dependsTasks.push_back(task);
+ }
found = true;
}
}
@@ -155,7 +159,7 @@ std::string Task::compiler() const
}
}
-std::set<std::shared_ptr<Task>> Task::getDependsTasks()
+std::vector<std::shared_ptr<Task>> Task::getDependsTasks()
{
return dependsTasks;
}