#include <stdio.h>
#include <string.h>
+#include "build.h"
#include "graph.h"
#include "ninja.h"
: 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;
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) {
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())
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;
}