Index: tools/gn/file_template.cc |
diff --git a/tools/gn/file_template.cc b/tools/gn/file_template.cc |
index 1616c52b9d3ff7aa8bfc6465dd7646463fc6aacd..995bb01621dd44a755b110dc68ac430c07575234 100644 |
--- a/tools/gn/file_template.cc |
+++ b/tools/gn/file_template.cc |
@@ -9,6 +9,8 @@ |
#include "tools/gn/escape.h" |
#include "tools/gn/filesystem_utils.h" |
+#include "tools/gn/string_utils.h" |
+#include "tools/gn/target.h" |
const char FileTemplate::kSource[] = "{{source}}"; |
const char FileTemplate::kSourceNamePart[] = "{{source_name_part}}"; |
@@ -92,6 +94,15 @@ FileTemplate::FileTemplate(const std::vector<std::string>& t) |
FileTemplate::~FileTemplate() { |
} |
+// static |
+FileTemplate FileTemplate::GetForTargetOutputs(const Target* target) { |
+ const Target::FileList& outputs = target->script_values().outputs(); |
+ std::vector<std::string> output_template_args; |
+ for (size_t i = 0; i < outputs.size(); i++) |
+ output_template_args.push_back(outputs[i].value()); |
+ return FileTemplate(output_template_args); |
+} |
+ |
bool FileTemplate::IsTypeUsed(Subrange::Type type) const { |
DCHECK(type > Subrange::LITERAL && type < Subrange::NUM_TYPES); |
return types_required_[type]; |