#include <msp/fs/dir.h>
#include <msp/fs/stat.h>
#include <msp/fs/utils.h>
+#include "filetarget.h"
#include "task.h"
using namespace std;
using namespace Msp;
-void Task::add_file(const FS::Path &f)
+void Task::add_target(const FileTarget &t)
{
- files.push_back(f);
+ targets.push_back(&t);
}
void Task::set_unlink(bool u)
void Task::prepare()
{
- for(const FS::Path &f: files)
+ for(const FileTarget *t: targets)
{
+ const FS::Path &f = t->get_path();
if(FS::exists(f))
{
// If the file exists, the directory it's in must exist too
#define TASK_H_
#include <string>
+#include <vector>
#include <sigc++/signal.h>
-#include <msp/fs/path.h>
#include "libbuilder_api.h"
+class FileTarget;
+
/**
Tasks are used to manage other programs and worker threads involved in the
build process. They are run asynchronously by default, but a wait() method is
sigc::signal<void, bool> signal_finished;
protected:
- std::vector<Msp::FS::Path> files;
+ std::vector<const FileTarget *> targets;
bool unlink = false;
Task() = default;
public:
virtual ~Task() { }
- /** Associate the task with a file. */
- void add_file(const Msp::FS::Path &);
+ /** Associate the task with a target. */
+ void add_target(const FileTarget &);
/** If set to true, the associated files are removed before the task is
started. */