void ActionTargetGenerator::DoRun() {
target_->set_output_type(output_type_);
- FillSources();
- if (err_->has_error())
+ if (!FillSources())
return;
if (output_type_ == Target::ACTION_FOREACH && target_->sources().empty()) {
// Foreach rules must always have some sources to have an effect.
return;
}
- FillInputs();
- if (err_->has_error())
+ if (!FillInputs())
return;
- FillScript();
- if (err_->has_error())
+ if (!FillScript())
return;
- FillScriptArgs();
- if (err_->has_error())
+ if (!FillScriptArgs())
return;
- FillOutputs(output_type_ == Target::ACTION_FOREACH);
- if (err_->has_error())
+ if (!FillOutputs(output_type_ == Target::ACTION_FOREACH))
return;
- FillDepfile();
- if (err_->has_error())
+ if (!FillDepfile())
return;
- CheckOutputs();
- if (err_->has_error())
+ if (!CheckOutputs())
return;
// Action outputs don't depend on the current toolchain so we can skip adding
// that dependency.
}
-void ActionTargetGenerator::FillScript() {
+bool ActionTargetGenerator::FillScript() {
// If this gets called, the target type requires a script, so error out
// if it doesn't have one.
const Value* value = scope_->GetValue(variables::kScript, true);
if (!value) {
*err_ = Err(function_call_, "This target type requires a \"script\".");
- return;
+ return false;
}
if (!value->VerifyTypeIs(Value::STRING, err_))
- return;
+ return false;
SourceFile script_file =
scope_->GetSourceDir().ResolveRelativeFile(value->string_value());
if (script_file.value().empty()) {
*err_ = Err(*value, "script name is empty");
- return;
+ return false;
}
target_->action_values().set_script(script_file);
+ return true;
}
-void ActionTargetGenerator::FillScriptArgs() {
+bool ActionTargetGenerator::FillScriptArgs() {
const Value* value = scope_->GetValue(variables::kArgs, true);
if (!value)
- return;
-
- if (!target_->action_values().args().Parse(*value, err_))
- return;
+ return true;
+ return target_->action_values().args().Parse(*value, err_);
}
-void ActionTargetGenerator::FillDepfile() {
+bool ActionTargetGenerator::FillDepfile() {
const Value* value = scope_->GetValue(variables::kDepfile, true);
if (!value)
- return;
+ return true;
SubstitutionPattern depfile;
if (!depfile.Parse(*value, err_))
- return;
+ return false;
if (!EnsureSubstitutionIsInOutputDir(depfile, *value))
- return;
+ return false;
target_->action_values().set_depfile(depfile);
+ return true;
}
-void ActionTargetGenerator::CheckOutputs() {
+bool ActionTargetGenerator::CheckOutputs() {
const SubstitutionList& outputs = target_->action_values().outputs();
if (outputs.list().empty()) {
*err_ = Err(function_call_, "Action has no outputs.",
"If you have no outputs, the build system can not tell when your\n"
"script needs to be run.");
- return;
+ return false;
}
if (output_type_ == Target::ACTION) {
"An action target should have the outputs completely specified. If\n"
"you want to provide a mapping from source to output, use an\n"
"\"action_foreach\" target.");
- return;
+ return false;
}
} else if (output_type_ == Target::ACTION_FOREACH) {
// A foreach target should always have a pattern in the outputs.
"An action_foreach target should have a source expansion pattern in\n"
"it to map source file to unique output file name. Otherwise, the\n"
"build system can't determine when your script needs to be run.");
- return;
+ return false;
}
}
+ return true;
}