Chromium Code Reviews| Index: tools/gn/action_target_generator.cc |
| diff --git a/tools/gn/action_target_generator.cc b/tools/gn/action_target_generator.cc |
| index 40523fe08b94ecd12bf00cf4dac9ee1994f74db4..83d5b55876460a470dde1272f7e0a898e2ac11ac 100644 |
| --- a/tools/gn/action_target_generator.cc |
| +++ b/tools/gn/action_target_generator.cc |
| @@ -48,6 +48,9 @@ void ActionTargetGenerator::DoRun() { |
| if (!FillScriptArgs()) |
| return; |
| + if (!FillResponseFileContents()) |
| + return; |
| + |
| if (!FillOutputs(output_type_ == Target::ACTION_FOREACH)) |
| return; |
| @@ -65,6 +68,28 @@ void ActionTargetGenerator::DoRun() { |
| // Action outputs don't depend on the current toolchain so we can skip adding |
| // that dependency. |
| + |
| + // response_file_contents and {{response_file_name}} in the args must go |
| + // together. |
| + const auto& required_args_substitutions = |
| + target_->action_values().args().required_types(); |
| + bool has_rsp_file_name = std::find( |
| + required_args_substitutions.begin(), required_args_substitutions.end(), |
| + SUBSTITUTION_RSP_FILE_NAME) != required_args_substitutions.end(); |
|
scottmg
2015/11/04 22:35:33
this is weird formatting, did clang-format do this
|
| + if (target_->action_values().uses_rsp_file() && !has_rsp_file_name) { |
| + *err_ = Err(function_call_, "Missing {{response_file_name}} in args.", |
| + "This target defines response_file_contents but doesn't use\n" |
| + "{{response_file_name}} in the args, which means the response file\n" |
| + "will be unused."); |
| + return; |
| + } |
| + if (!target_->action_values().uses_rsp_file() && has_rsp_file_name) { |
| + *err_ = Err(function_call_, "Missing response_file_content definition.", |
| + "This target uses {{response_file_name}} in the args, but does not\n" |
| + "define response_file_content which means the response file\n" |
| + "will be empty."); |
| + return; |
| + } |
| } |
| bool ActionTargetGenerator::FillScript() { |
| @@ -95,6 +120,13 @@ bool ActionTargetGenerator::FillScriptArgs() { |
| return target_->action_values().args().Parse(*value, err_); |
| } |
| +bool ActionTargetGenerator::FillResponseFileContents() { |
| + const Value* value = scope_->GetValue(variables::kResponseFileContents, true); |
| + if (!value) |
| + return true; |
| + return target_->action_values().rsp_file_contents().Parse(*value, err_); |
| +} |
| + |
| bool ActionTargetGenerator::FillDepfile() { |
| const Value* value = scope_->GetValue(variables::kDepfile, true); |
| if (!value) |