5 #include <sigc++/signal.h>
6 #include <msp/fs/path.h>
7 #include "libbuilder_api.h"
10 Tasks are used to manage other programs and worker threads involved in the
11 build process. They are run asynchronously by default, but a wait() method is
12 provided should it be necessary to wait for a task to finish.
14 class LIBBUILDER_API Task
24 sigc::signal<void, bool> signal_finished;
27 std::vector<Msp::FS::Path> files;
34 /** Associate the task with a file. */
35 void add_file(const Msp::FS::Path &);
37 /** If set to true, the associated files are removed before the task is
39 void set_unlink(bool = true);
41 /** Returns the command being executed for this task. Only makes sense if
42 an external command is involved. */
43 virtual std::string get_command() const = 0;
46 virtual void start() = 0;
49 /// Ensures that the output directory exists and removes files if necessary.
53 /// Checks the status of the task and immediately returns.
54 virtual Status check() = 0;
56 /// Waits for the task to finish and returns its final status.
57 virtual Status wait() = 0;