| 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/functions.h" | 5 #include "tools/gn/functions.h" |
| 6 | 6 |
| 7 #include "tools/gn/parse_tree.h" | 7 #include "tools/gn/parse_tree.h" |
| 8 #include "tools/gn/scope.h" | 8 #include "tools/gn/scope.h" |
| 9 #include "tools/gn/value.h" | 9 #include "tools/gn/value.h" |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 "\n" | 59 "\n" |
| 60 " # Intermediate target to compile IDL to C source.\n" | 60 " # Intermediate target to compile IDL to C source.\n" |
| 61 " custom(\"${target_name}_code_gen\") {\n" | 61 " custom(\"${target_name}_code_gen\") {\n" |
| 62 " # The |sources| will be inherited from the surrounding scope so\n" | 62 " # The |sources| will be inherited from the surrounding scope so\n" |
| 63 " # we don't need to redefine it.\n" | 63 " # we don't need to redefine it.\n" |
| 64 " script = \"foo.py\"\n" | 64 " script = \"foo.py\"\n" |
| 65 " outputs = filter # Variable from above.\n" | 65 " outputs = filter # Variable from above.\n" |
| 66 " }\n" | 66 " }\n" |
| 67 "\n" | 67 "\n" |
| 68 " # Name the static library the same as the template invocation so\n" | 68 " # Name the static library the same as the template invocation so\n" |
| 69 " # instanting this template produces something that other targets\n" | 69 " # instancing this template produces something that other targets\n" |
| 70 " # can link to in their deps.\n" | 70 " # can link to in their deps.\n" |
| 71 " static_library(target_name) {\n" | 71 " static_library(target_name) {\n" |
| 72 " # Generates the list of sources.\n" | 72 " # Generates the list of sources.\n" |
| 73 " # See \"gn help process_file_template\"\n" | 73 " # See \"gn help process_file_template\"\n" |
| 74 " sources = process_file_template(sources, filter)\n" | 74 " sources = process_file_template(sources, filter)\n" |
| 75 " }\n" | 75 " }\n" |
| 76 " }\n" | 76 " }\n" |
| 77 "\n" | 77 "\n" |
| 78 "Example of invoking the resulting template:\n" | 78 "Example of invoking the resulting template:\n" |
| 79 "\n" | 79 "\n" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 104 err->AppendSubErr(Err(existing_template->function(), | 104 err->AppendSubErr(Err(existing_template->function(), |
| 105 "Previous definition.")); | 105 "Previous definition.")); |
| 106 return Value(); | 106 return Value(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 scope->AddTemplate(template_name, function); | 109 scope->AddTemplate(template_name, function); |
| 110 return Value(); | 110 return Value(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace functions | 113 } // namespace functions |
| OLD | NEW |