time_t last_update_;
int finished_edges_, total_edges_;
- bool verbose_;
+
+ BuildConfig::Verbosity verbosity_;
};
BuildStatusLog::BuildStatusLog()
: last_update_(time(NULL)), finished_edges_(0), total_edges_(0),
- verbose_(false) {}
+ verbosity_(BuildConfig::NORMAL) {}
void BuildStatusLog::PlanHasTotalEdges(int total) {
total_edges_ = total;
void BuildStatusLog::BuildEdgeStarted(Edge* edge) {
string desc = edge->GetDescription();
- if (!verbose_ && !desc.empty())
- printf("%s\n", desc.c_str());
- else
- printf("%s\n", edge->EvaluateCommand().c_str());
+ if (verbosity_ != BuildConfig::QUIET) {
+ if (verbosity_ != BuildConfig::VERBOSE && !desc.empty())
+ printf("%s\n", desc.c_str());
+ else
+ printf("%s\n", edge->EvaluateCommand().c_str());
+ }
}
void BuildStatusLog::BuildEdgeFinished(Edge* edge) {
else
command_runner_ = new RealCommandRunner;
log_ = new BuildStatusLog;
- log_->verbose_ = config.verbose;
+ log_->verbosity_ = config.verbosity;
}
Node* Builder::AddTarget(const string& name, string* err) {
};
struct BuildConfig {
- BuildConfig() : verbose(false), dry_run(false) {}
-
- bool verbose;
+ BuildConfig() : verbosity(NORMAL), dry_run(false) {}
+
+ enum Verbosity {
+ NORMAL,
+ QUIET, // No output -- used when testing.
+ VERBOSE
+ };
+ Verbosity verbosity;
bool dry_run;
};
struct BuildTest : public StateTestWithBuiltinRules,
public CommandRunner,
public DiskInterface {
- BuildTest() : config_(), builder_(&state_, config_), now_(1),
+ BuildTest() : config_(MakeConfig()), builder_(&state_, config_), now_(1),
last_command_(NULL) {
builder_.disk_interface_ = this;
builder_.command_runner_ = this;
return "";
}
+ BuildConfig MakeConfig() {
+ BuildConfig config;
+ config.verbosity = BuildConfig::QUIET;
+ return config;
+ }
+
BuildConfig config_;
Builder builder_;
int now_;