From: Evan Martin Date: Sun, 23 Jan 2011 20:00:55 +0000 (-0800) Subject: move dry run info inside build log X-Git-Tag: release-120715~508 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=791f0634684f157f7ed443165ac9985f2c04f8ed;p=platform%2Fupstream%2Fninja.git move dry run info inside build log --- diff --git a/src/build_log.cc b/src/build_log.cc index 144ae14..b8a782f 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -4,6 +4,7 @@ #include #include +#include "build.h" #include "graph.h" #include "ninja.h" @@ -18,6 +19,9 @@ BuildLog::BuildLog() : log_file_(NULL), config_(NULL), needs_recompaction_(false) {} bool BuildLog::OpenForWrite(const string& path, string* err) { + if (config_ && config_->dry_run) + return true; // Do nothing, report success. + if (needs_recompaction_) { if (!Recompact(path, err)) return false; @@ -61,7 +65,6 @@ void BuildLog::Close() { log_file_ = NULL; } -// Load the on-disk log. bool BuildLog::Load(const string& path, string* err) { FILE* file = fopen(path.c_str(), "r"); if (!file) { @@ -115,7 +118,6 @@ bool BuildLog::Load(const string& path, string* err) { return true; } -// Lookup a previously-run command by its output path. BuildLog::LogEntry* BuildLog::LookupByOutput(const string& path) { Log::iterator i = log_.find(path); if (i != log_.end()) diff --git a/src/ninja.cc b/src/ninja.cc index 608297e..dc878d0 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -181,7 +181,7 @@ int main(int argc, char** argv) { return 1; } - if (!config.dry_run && !build_log.OpenForWrite(kLogPath, &err)) { + if (!build_log.OpenForWrite(kLogPath, &err)) { fprintf(stderr, "error opening build log: %s\n", err.c_str()); return 1; }