| Index: tools/gn/function_template.cc
|
| diff --git a/tools/gn/function_template.cc b/tools/gn/function_template.cc
|
| index 7af688e75b2344c3b1039d231e13c9f2249169c1..1f1da82fb269f2329f8c7699f39fc554fb62631f 100644
|
| --- a/tools/gn/function_template.cc
|
| +++ b/tools/gn/function_template.cc
|
| @@ -28,7 +28,7 @@ const char kTemplate_Help[] =
|
| " other files will import (see \"gn help import\") so your template\n"
|
| " rule can be shared across build files.\n"
|
| "\n"
|
| - "More details:\n"
|
| + "Variables and templates:\n"
|
| "\n"
|
| " When you call template() it creates a closure around all variables\n"
|
| " currently in scope with the code in the template block. When the\n"
|
| @@ -44,6 +44,19 @@ const char kTemplate_Help[] =
|
| " that code specifies the file names. This means all files internal\n"
|
| " to the template should use absolute names.\n"
|
| "\n"
|
| + " A template will typically forward some or all variables from the\n"
|
| + " invoking scope to a target that it defines. Often, such variables\n"
|
| + " might be optional. Use the pattern:\n"
|
| + "\n"
|
| + " if (defined(invoker.deps)) {\n"
|
| + " deps = invoker.deps\n"
|
| + " }\n"
|
| + "\n"
|
| + " The function forward_variables_from() provides a shortcut to forward\n"
|
| + " one or more or possibly all variables in this manner:\n"
|
| + "\n"
|
| + " forward_variables_from(invoker, [\"deps\", \"public_deps\"])\n"
|
| + "\n"
|
| "Target naming:\n"
|
| "\n"
|
| " Your template should almost always define a built-in target with the\n"
|
|
|