Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: tools/gn/action_target_generator.cc

Issue 1430043002: Support script response files in GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment, random build fix Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/action_target_generator.h ('k') | tools/gn/action_values.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b2d7e2757a5059397cf32089b2ddecd028f8114c 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,29 @@ 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();
+ 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 +121,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)
« no previous file with comments | « tools/gn/action_target_generator.h ('k') | tools/gn/action_values.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698