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/template.h" | 9 #include "tools/gn/template.h" |
10 #include "tools/gn/value.h" | 10 #include "tools/gn/value.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 " idl(\"foo\") {...\n" | 65 " idl(\"foo\") {...\n" |
66 " you will normally want this to expand to something defining a\n" | 66 " you will normally want this to expand to something defining a\n" |
67 " source_set or static_library named \"foo\" (among other things you may\n" | 67 " source_set or static_library named \"foo\" (among other things you may\n" |
68 " need). This way, when another target specifies a dependency on\n" | 68 " need). This way, when another target specifies a dependency on\n" |
69 " \"foo\", the static_library or source_set will be linked.\n" | 69 " \"foo\", the static_library or source_set will be linked.\n" |
70 "\n" | 70 "\n" |
71 " It is also important that any other targets your template expands to\n" | 71 " It is also important that any other targets your template expands to\n" |
72 " have globally unique names, or you will get collisions.\n" | 72 " have globally unique names, or you will get collisions.\n" |
73 "\n" | 73 "\n" |
74 " Access the invoking name in your template via the implicit\n" | 74 " Access the invoking name in your template via the implicit\n" |
75 " \"target_name\" variable. This should also be the basis of how other\n" | 75 " \"target_name\" variable. This should also be the basis for how other\n" |
76 " targets that a template expands to to ensure uniquness.\n" | 76 " targets that a template expands to ensure uniqueness.\n" |
77 "\n" | 77 "\n" |
78 " A typical example would be a template that defines an action to\n" | 78 " A typical example would be a template that defines an action to\n" |
79 " generate some source files, and a source_set to compile that source.\n" | 79 " generate some source files, and a source_set to compile that source.\n" |
80 " Your template would name the source_set \"target_name\" because\n" | 80 " Your template would name the source_set \"target_name\" because\n" |
81 " that's what you want external targets to depend on to link your code.\n" | 81 " that's what you want external targets to depend on to link your code.\n" |
82 " And you would name the action something like \"${target_name}_action\"\n" | 82 " And you would name the action something like \"${target_name}_action\"\n" |
83 " to make it unique. The source set would have a dependency on the\n" | 83 " to make it unique. The source set would have a dependency on the\n" |
84 " action to make it run.\n" | 84 " action to make it run.\n" |
85 "\n" | 85 "\n" |
86 "Example of defining a template:\n" | 86 "Example of defining a template:\n" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 err->AppendSubErr(Err(existing_template->GetDefinitionRange(), | 189 err->AppendSubErr(Err(existing_template->GetDefinitionRange(), |
190 "Previous definition.")); | 190 "Previous definition.")); |
191 return Value(); | 191 return Value(); |
192 } | 192 } |
193 | 193 |
194 scope->AddTemplate(template_name, new Template(scope, function)); | 194 scope->AddTemplate(template_name, new Template(scope, function)); |
195 return Value(); | 195 return Value(); |
196 } | 196 } |
197 | 197 |
198 } // namespace functions | 198 } // namespace functions |
OLD | NEW |