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

Unified Diff: tools/gn/variables.cc

Issue 1621053002: Add an assert_no_deps variable to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix Created 4 years, 11 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/variables.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/variables.cc
diff --git a/tools/gn/variables.cc b/tools/gn/variables.cc
index a835b22d6b2c6fa5db7dd999dd9a3730e4070550..2dfef5bebd7aa3a3cafbee31d5e647e47cb90356 100644
--- a/tools/gn/variables.cc
+++ b/tools/gn/variables.cc
@@ -391,6 +391,49 @@ const char kArgs_Help[] =
"\n"
" See also \"gn help action\" and \"gn help action_foreach\".\n";
+const char kAssertNoDeps[] = "assert_no_deps";
+const char kAssertNoDeps_HelpShort[] =
+ "assert_no_deps: [label pattern list] Ensure no deps on these targets.";
+const char kAssertNoDeps_Help[] =
+ "assert_no_deps: Ensure no deps on these targets.\n"
+ "\n"
+ " A list of label patterns.\n"
+ "\n"
+ " This list is a list of patterns that must not match any of the\n"
+ " transitive dependencies of the target. These include all public,\n"
+ " private, and data dependencies, and cross shared library boundaries.\n"
+ " This allows you to express that undesirable code isn't accidentally\n"
+ " added to downstream dependencies in a way that might otherwise be\n"
+ " difficult to notice.\n"
+ "\n"
+ " Checking does not cross executable boundaries. If a target depends on\n"
+ " an executable, it's assumed that the executable is a tool that is\n"
+ " producing part of the build rather than something that is linked and\n"
+ " distributed. This allows assert_no_deps to express what is distributed\n"
+ " in the final target rather than depend on the internal build steps\n"
+ " (which may include non-distributable code).\n"
+ "\n"
+ " See \"gn help label_pattern\" for the format of the entries in the\n"
+ " list. These patterns allow blacklisting individual targets or whole\n"
+ " directory hierarchies.\n"
+ "\n"
+ " Sometimes it is desirable to enforce that many targets have no\n"
+ " dependencies on a target or set of targets. One efficient way to\n"
+ " express this is to create a group with the assert_no_deps rule on\n"
+ " it, and make that group depend on all targets you want to apply that\n"
+ " assertion to.\n"
+ "\n"
+ "Example\n"
+ "\n"
+ " executable(\"doom_melon\") {\n"
+ " deps = [ \"//foo:bar\" ]\n"
+ " ...\n"
+ " assert_no_deps = [\n"
+ " \"//evil/*\", # Don't link any code from the evil directory.\n"
+ " \"//foo:test_support\", # This target is also disallowed.\n"
+ " ]\n"
+ " }\n";
+
const char kCflags[] = "cflags";
const char kCflags_HelpShort[] =
"cflags: [string list] Flags passed to all C compiler variants.";
@@ -1400,6 +1443,7 @@ const VariableInfoMap& GetTargetVariables() {
INSERT_VARIABLE(AllowCircularIncludesFrom)
INSERT_VARIABLE(Args)
INSERT_VARIABLE(Asmflags)
+ INSERT_VARIABLE(AssertNoDeps)
INSERT_VARIABLE(Cflags)
INSERT_VARIABLE(CflagsC)
INSERT_VARIABLE(CflagsCC)
« no previous file with comments | « tools/gn/variables.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698