| Index: tools/gn/action_target_generator.cc
|
| diff --git a/tools/gn/action_target_generator.cc b/tools/gn/action_target_generator.cc
|
| index bbe413c98bf8e35c4f339a047654cc27cd99271d..793635937b9ea15576fcffe069607ad6f41f1f19 100644
|
| --- a/tools/gn/action_target_generator.cc
|
| +++ b/tools/gn/action_target_generator.cc
|
| @@ -29,8 +29,7 @@ ActionTargetGenerator::~ActionTargetGenerator() {
|
| 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.
|
| @@ -40,84 +39,78 @@ void ActionTargetGenerator::DoRun() {
|
| 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) {
|
| @@ -126,7 +119,7 @@ void ActionTargetGenerator::CheckOutputs() {
|
| "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.
|
| @@ -136,7 +129,8 @@ void ActionTargetGenerator::CheckOutputs() {
|
| "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;
|
| }
|
|
|