6 #include <sigc++/signal.h>
7 #include "libbuilder_api.h"
12 Tasks are used to manage other programs and worker threads involved in the
13 build process. They are run asynchronously by default, but a wait() method is
14 provided should it be necessary to wait for a task to finish.
16 class LIBBUILDER_API Task
26 sigc::signal<void, bool> signal_finished;
29 std::vector<const FileTarget *> targets;
36 /** Associate the task with a target. */
37 void add_target(const FileTarget &);
39 /** If set to true, the associated files are removed before the task is
41 void set_unlink(bool = true);
43 /** Returns the command being executed for this task. Only makes sense if
44 an external command is involved. */
45 virtual std::string get_command() const = 0;
48 virtual void start() = 0;
51 /// Ensures that the output directory exists and removes files if necessary.
55 /// Checks the status of the task and immediately returns.
56 virtual Status check() = 0;
58 /// Waits for the task to finish and returns its final status.
59 virtual Status wait() = 0;