{}
BuildLog::BuildLog()
- : log_file_(NULL), needs_recompaction_(false), quiet_(false) {}
+ : log_file_(NULL), needs_recompaction_(false) {}
BuildLog::~BuildLog() {
Close();
bool BuildLog::Recompact(const string& path, const BuildLogUser& user,
string* err) {
METRIC_RECORD(".ninja_log recompact");
- if (!quiet_)
- printf("Recompacting log...\n");
Close();
string temp_path = path + ".recompact";
/// Rewrite the known log entries, throwing away old data.
bool Recompact(const string& path, const BuildLogUser& user, string* err);
- void set_quiet(bool quiet) { quiet_ = quiet; }
typedef ExternalStringHashMap<LogEntry*>::Type Entries;
const Entries& entries() const { return entries_; }
Entries entries_;
FILE* log_file_;
bool needs_recompaction_;
- bool quiet_;
};
#endif // NINJA_BUILD_LOG_H_
ASSERT_TRUE(log2.LookupByOutput("out"));
ASSERT_TRUE(log2.LookupByOutput("out2"));
// ...and force a recompaction.
- log2.set_quiet(true);
EXPECT_TRUE(log2.OpenForWrite(kTestFilename, *this, &err));
log2.Close();
bool DepsLog::Recompact(const string& path, string* err) {
METRIC_RECORD(".ninja_deps recompact");
- if (!quiet_)
- printf("Recompacting deps...\n");
Close();
string temp_path = path + ".recompact";
/// wins, allowing updates to just be appended to the file. A separate
/// repacking step can run occasionally to remove dead records.
struct DepsLog {
- DepsLog() : needs_recompaction_(false), quiet_(false), file_(NULL) {}
+ DepsLog() : needs_recompaction_(false), file_(NULL) {}
~DepsLog();
// Writing (build-time) interface.
/// Rewrite the known log entries, throwing away old data.
bool Recompact(const string& path, string* err);
- void set_quiet(bool quiet) { quiet_ = quiet; }
/// Returns if the deps entry for a node is still reachable from the manifest.
///
bool RecordId(Node* node);
bool needs_recompaction_;
- bool quiet_;
FILE* file_;
/// Maps id -> Node.
ASSERT_EQ("foo.h", deps->nodes[0]->path());
ASSERT_EQ("baz.h", deps->nodes[1]->path());
- log.set_quiet(true);
ASSERT_TRUE(log.Recompact(kTestFilename, &err));
// The in-memory deps graph should still be valid after recompaction.
ASSERT_EQ("foo.h", deps->nodes[0]->path());
ASSERT_EQ("baz.h", deps->nodes[1]->path());
- log.set_quiet(true);
ASSERT_TRUE(log.Recompact(kTestFilename, &err));
// The previous entries should have been removed.