summaryrefslogtreecommitdiffstats
path: root/src/build.h
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-02-14 00:55:16 (GMT)
committerEvan Martin <martine@danga.com>2012-02-14 00:55:16 (GMT)
commit0eebd5fe1dec021a63110ecab8fa411f9980745f (patch)
tree470e397b33e8538d82ab2ce842cfd708450d872c /src/build.h
parent51066421eef67847b244154119ca77a893bd6be8 (diff)
parent44f58aeca923d6e3001636f8c0d24a6d513d8ea2 (diff)
downloadNinja-0eebd5fe1dec021a63110ecab8fa411f9980745f.zip
Ninja-0eebd5fe1dec021a63110ecab8fa411f9980745f.tar.gz
Ninja-0eebd5fe1dec021a63110ecab8fa411f9980745f.tar.bz2
Merge pull request #176 from pcc/exit-cleanup
Implement cleanup-on-interrupt
Diffstat (limited to 'src/build.h')
-rw-r--r--src/build.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/build.h b/src/build.h
index 586d1ff..778d59d 100644
--- a/src/build.h
+++ b/src/build.h
@@ -20,8 +20,11 @@
#include <string>
#include <queue>
#include <vector>
+#include <memory>
using namespace std;
+#include "exit_status.h"
+
struct BuildLog;
struct Edge;
struct DiskInterface;
@@ -87,13 +90,15 @@ struct CommandRunner {
virtual bool CanRunMore() = 0;
virtual bool StartCommand(Edge* edge) = 0;
/// Wait for a command to complete.
- virtual Edge* WaitForCommand(bool* success, string* output) = 0;
+ virtual Edge* WaitForCommand(ExitStatus* status, string* output) = 0;
+ virtual vector<Edge*> GetActiveEdges() { return vector<Edge*>(); }
+ virtual void Abort() {}
};
/// Options (e.g. verbosity, parallelism) passed to a build.
struct BuildConfig {
BuildConfig() : verbosity(NORMAL), dry_run(false), parallelism(1),
- swallow_failures(0) {}
+ failures_allowed(1) {}
enum Verbosity {
NORMAL,
@@ -103,12 +108,13 @@ struct BuildConfig {
Verbosity verbosity;
bool dry_run;
int parallelism;
- int swallow_failures;
+ int failures_allowed;
};
/// Builder wraps the build process: starting commands, updating status.
struct Builder {
Builder(State* state, const BuildConfig& config);
+ ~Builder();
Node* AddTarget(const string& name, string* err);
@@ -130,9 +136,14 @@ struct Builder {
const BuildConfig& config_;
Plan plan_;
DiskInterface* disk_interface_;
- CommandRunner* command_runner_;
+ auto_ptr<CommandRunner> command_runner_;
struct BuildStatus* status_;
struct BuildLog* log_;
+
+private:
+ // Unimplemented copy ctor and operator= ensure we don't copy the auto_ptr.
+ Builder(const Builder &other); // DO NOT IMPLEMENT
+ void operator=(const Builder &other); // DO NOT IMPLEMENT
};
#endif // NINJA_BUILD_H_