| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tools/gn/file_template.h" | 5 #include "tools/gn/file_template.h" |
| 6 #include "tools/gn/functions.h" | 6 #include "tools/gn/functions.h" |
| 7 #include "tools/gn/parse_tree.h" | 7 #include "tools/gn/parse_tree.h" |
| 8 | 8 |
| 9 namespace functions { | 9 namespace functions { |
| 10 | 10 |
| 11 const char kProcessFileTemplate[] = "process_file_template"; | 11 const char kProcessFileTemplate[] = "process_file_template"; |
| 12 const char kProcessFileTemplate_HelpShort[] = | 12 const char kProcessFileTemplate_HelpShort[] = |
| 13 "process_file_template: Do template expansion over a list of files."; | 13 "process_file_template: Do template expansion over a list of files."; |
| 14 const char kProcessFileTemplate_Help[] = | 14 const char kProcessFileTemplate_Help[] = |
| 15 "process_file_template: Do template expansion over a list of files.\n" | 15 "process_file_template: Do template expansion over a list of files.\n" |
| 16 "\n" | 16 "\n" |
| 17 " process_file_template(source_list, template)\n" | 17 " process_file_template(source_list, template)\n" |
| 18 "\n" | 18 "\n" |
| 19 " process_file_template applies a template list to a source file list,\n" | 19 " process_file_template applies a template list to a source file list,\n" |
| 20 " returning the result of applying each template to each source. This is\n" | 20 " returning the result of applying each template to each source. This is\n" |
| 21 " typically used for computing output file names from input files.\n" | 21 " typically used for computing output file names from input files.\n" |
| 22 "\n" | 22 "\n" |
| 23 " In most cases, get_target_outputs() will give the same result with\n" |
| 24 " shorter, more maintainable code. This function should only be used\n" |
| 25 " when that function can't be used (like there's no target or the target\n" |
| 26 " is defined in another build file).\n" |
| 27 "\n" |
| 23 "Arguments:\n" | 28 "Arguments:\n" |
| 24 "\n" | 29 "\n" |
| 25 " The source_list is a list of file names.\n" | 30 " The source_list is a list of file names.\n" |
| 26 "\n" | 31 "\n" |
| 27 " The template can be a string or a list. If it is a list, multiple\n" | 32 " The template can be a string or a list. If it is a list, multiple\n" |
| 28 " output strings are generated for each input.\n" | 33 " output strings are generated for each input.\n" |
| 29 "\n" | 34 "\n" |
| 30 " The following template substrings are used in the template arguments\n" | 35 " The following template substrings are used in the template arguments\n" |
| 31 " and are replaced with the corresponding part of the input file name:\n" | 36 " and are replaced with the corresponding part of the input file name:\n" |
| 32 "\n" | 37 "\n" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 FileTemplate file_template(args[1], err); | 70 FileTemplate file_template(args[1], err); |
| 66 if (err->has_error()) | 71 if (err->has_error()) |
| 67 return Value(); | 72 return Value(); |
| 68 | 73 |
| 69 Value ret(function, Value::LIST); | 74 Value ret(function, Value::LIST); |
| 70 file_template.Apply(args[0], function, &ret.list_value(), err); | 75 file_template.Apply(args[0], function, &ret.list_value(), err); |
| 71 return ret; | 76 return ret; |
| 72 } | 77 } |
| 73 | 78 |
| 74 } // namespace functions | 79 } // namespace functions |
| OLD | NEW |