Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1464)

Unified Diff: tools/gn/function_template.cc

Issue 1263053003: Add forward_variables_from() and target() to GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More spelling fixes Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/function_forward_variables_from_unittest.cc ('k') | tools/gn/functions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
« no previous file with comments | « tools/gn/function_forward_variables_from_unittest.cc ('k') | tools/gn/functions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698