Index: tools/gn/action_target_generator.cc |
diff --git a/tools/gn/action_target_generator.cc b/tools/gn/action_target_generator.cc |
index 0ad3928ad5a9cc20772b5814cefe247050d98f21..bbe413c98bf8e35c4f339a047654cc27cd99271d 100644 |
--- a/tools/gn/action_target_generator.cc |
+++ b/tools/gn/action_target_generator.cc |
@@ -13,21 +13,6 @@ |
#include "tools/gn/value_extractors.h" |
#include "tools/gn/variables.h" |
-namespace { |
- |
-// Returns true if the list of files looks like it might have a {{ }} pattern |
-// in it. Used for error checking. |
-bool StringListHasPattern(const std::vector<std::string>& files) { |
- for (size_t i = 0; i < files.size(); i++) { |
- if (files[i].find("{{") != std::string::npos && |
- files[i].find("}}") != std::string::npos) |
- return true; |
- } |
- return false; |
-} |
- |
-} // namespace |
- |
ActionTargetGenerator::ActionTargetGenerator( |
Target* target, |
Scope* scope, |
@@ -67,7 +52,7 @@ void ActionTargetGenerator::DoRun() { |
if (err_->has_error()) |
return; |
- FillOutputs(); |
+ FillOutputs(output_type_ == Target::ACTION_FOREACH); |
if (err_->has_error()) |
return; |
@@ -108,8 +93,7 @@ void ActionTargetGenerator::FillScriptArgs() { |
if (!value) |
return; |
- if (!ExtractListOfStringValues(*value, &target_->action_values().args(), |
- err_)) |
+ if (!target_->action_values().args().Parse(*value, err_)) |
return; |
} |
@@ -117,14 +101,19 @@ void ActionTargetGenerator::FillDepfile() { |
const Value* value = scope_->GetValue(variables::kDepfile, true); |
if (!value) |
return; |
- target_->action_values().set_depfile( |
- scope_->settings()->build_settings()->build_dir().ResolveRelativeFile( |
- value->string_value())); |
+ |
+ SubstitutionPattern depfile; |
+ if (!depfile.Parse(*value, err_)) |
+ return; |
+ if (!EnsureSubstitutionIsInOutputDir(depfile, *value)) |
+ return; |
+ |
+ target_->action_values().set_depfile(depfile); |
} |
void ActionTargetGenerator::CheckOutputs() { |
- const std::vector<std::string>& outputs = target_->action_values().outputs(); |
- if (outputs.empty()) { |
+ 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."); |
@@ -132,8 +121,7 @@ void ActionTargetGenerator::CheckOutputs() { |
} |
if (output_type_ == Target::ACTION) { |
- // Make sure the outputs for an action have no patterns in them. |
- if (StringListHasPattern(outputs)) { |
+ if (!outputs.required_types().empty()) { |
*err_ = Err(function_call_, "Action has patterns in the output.", |
"An action target should have the outputs completely specified. If\n" |
"you want to provide a mapping from source to output, use an\n" |
@@ -142,7 +130,7 @@ void ActionTargetGenerator::CheckOutputs() { |
} |
} else if (output_type_ == Target::ACTION_FOREACH) { |
// A foreach target should always have a pattern in the outputs. |
- if (!StringListHasPattern(outputs)) { |
+ if (outputs.required_types().empty()) { |
*err_ = Err(function_call_, |
"action_foreach should have a pattern in the output.", |
"An action_foreach target should have a source expansion pattern in\n" |