Chromium Code Reviews| 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/variables.h" | 5 #include "tools/gn/variables.h" |
| 6 | 6 |
| 7 namespace variables { | 7 namespace variables { |
| 8 | 8 |
| 9 // Built-in variables ---------------------------------------------------------- | 9 // Built-in variables ---------------------------------------------------------- |
| 10 | 10 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 " This addition happens in a second phase once a target and all of its\n" | 274 " This addition happens in a second phase once a target and all of its\n" |
| 275 " dependencies have been resolved. Therefore, a target will not see\n" | 275 " dependencies have been resolved. Therefore, a target will not see\n" |
| 276 " these force-added configs in their \"configs\" variable while the\n" | 276 " these force-added configs in their \"configs\" variable while the\n" |
| 277 " script is running, and then can not be removed. As a result, this\n" | 277 " script is running, and then can not be removed. As a result, this\n" |
| 278 " capability should generally only be used to add defines and include\n" | 278 " capability should generally only be used to add defines and include\n" |
| 279 " directories necessary to compile a target's headers.\n" | 279 " directories necessary to compile a target's headers.\n" |
| 280 "\n" | 280 "\n" |
| 281 " See also \"direct_dependent_configs\".\n" | 281 " See also \"direct_dependent_configs\".\n" |
| 282 COMMON_ORDERING_HELP; | 282 COMMON_ORDERING_HELP; |
| 283 | 283 |
| 284 const char kAllowCircularIncludesFrom[] = "allow_circular_includes_from"; | |
| 285 const char kAllowCircularIncludesFrom_HelpShort[] = | |
| 286 "allow_circular_includes_from: [label list] Permit include cycles."; | |
|
viettrungluu
2014/08/28 19:47:54
"include cycles" is inaccurate and misleading.
| |
| 287 const char kAllowCircularIncludesFrom_Help[] = | |
| 288 "allow_circular_includes_from: Permit include cycles from listed targets.\n" | |
|
viettrungluu
2014/08/28 19:47:54
"Permit includes from the listed targets, which ar
| |
| 289 "\n" | |
| 290 " A list of target labels. Must be a subset of the target's \"deps\".\n" | |
| 291 "\n" | |
| 292 " Normally, for a file in target A to include a file from target B,\n" | |
| 293 " A must list B as a dependency. This invariant is enforced by the\n" | |
| 294 " \"gn check\" command (and the --check flag to \"gn gen\").\n" | |
| 295 "\n" | |
| 296 " Sometimes, two targets might be the same unit for linking purposes\n" | |
| 297 " (two source sets or static libraries that would always be linked\n" | |
| 298 " together in a final executable or shared library). In this case,\n" | |
| 299 " you want A to be able to include B's headers, and B to include A's\n" | |
| 300 " headers.\n" | |
| 301 "\n" | |
| 302 " This list, if specified, lists which of the dependencies of the\n" | |
| 303 " current target can include header files from the current target.\n" | |
| 304 " That is, if A depends on B, B can only include headers from A if it is\n" | |
|
viettrungluu
2014/08/27 23:30:40
Does A have to depend on B? What if you put B in t
brettw
2014/08/28 05:46:16
It must depend on B directly, there is code in the
| |
| 305 " in A's allow_circular_includes_from list.\n" | |
| 306 "\n" | |
| 307 "Example\n" | |
| 308 "\n" | |
| 309 " source_set(\"a\") {\n" | |
| 310 " deps = [ \":b\", \":c\" ]\n" | |
| 311 " allow_circular_includes_from = [ \":b\" ]\n" | |
| 312 " ...\n" | |
| 313 " }\n"; | |
| 314 | |
| 284 const char kArgs[] = "args"; | 315 const char kArgs[] = "args"; |
| 285 const char kArgs_HelpShort[] = | 316 const char kArgs_HelpShort[] = |
| 286 "args: [string list] Arguments passed to an action."; | 317 "args: [string list] Arguments passed to an action."; |
| 287 const char kArgs_Help[] = | 318 const char kArgs_Help[] = |
| 288 "args: Arguments passed to an action.\n" | 319 "args: Arguments passed to an action.\n" |
| 289 "\n" | 320 "\n" |
| 290 " For action and action_foreach targets, args is the list of arguments\n" | 321 " For action and action_foreach targets, args is the list of arguments\n" |
| 291 " to pass to the script. Typically you would use source expansion (see\n" | 322 " to pass to the script. Typically you would use source expansion (see\n" |
| 292 " \"gn help source_expansion\") to insert the source file names.\n" | 323 " \"gn help source_expansion\") to insert the source file names.\n" |
| 293 "\n" | 324 "\n" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 323 const char kCflagsObjC[] = "cflags_objc"; | 354 const char kCflagsObjC[] = "cflags_objc"; |
| 324 const char kCflagsObjC_HelpShort[] = | 355 const char kCflagsObjC_HelpShort[] = |
| 325 "cflags_objc: [string list] Flags passed to the Objective C compiler."; | 356 "cflags_objc: [string list] Flags passed to the Objective C compiler."; |
| 326 const char* kCflagsObjC_Help = kCommonCflagsHelp; | 357 const char* kCflagsObjC_Help = kCommonCflagsHelp; |
| 327 | 358 |
| 328 const char kCflagsObjCC[] = "cflags_objcc"; | 359 const char kCflagsObjCC[] = "cflags_objcc"; |
| 329 const char kCflagsObjCC_HelpShort[] = | 360 const char kCflagsObjCC_HelpShort[] = |
| 330 "cflags_objcc: [string list] Flags passed to the Objective C++ compiler."; | 361 "cflags_objcc: [string list] Flags passed to the Objective C++ compiler."; |
| 331 const char* kCflagsObjCC_Help = kCommonCflagsHelp; | 362 const char* kCflagsObjCC_Help = kCommonCflagsHelp; |
| 332 | 363 |
| 364 const char kCheckIncludes[] = "check_includes"; | |
| 365 const char kCheckIncludes_HelpShort[] = | |
| 366 "check_includes: [boolean] Controls whether a target's files are checked."; | |
| 367 const char kCheckIncludes_Help[] = | |
| 368 "check_includes: [boolean] Controls whether a target's files are checked.\n" | |
| 369 "\n" | |
| 370 " When true (the default), the \"gn check\" command (as well as\n" | |
| 371 " \"gn gen\" with the --check flag) will check this target's sources\n" | |
| 372 " and headers for proper dependencies.\n" | |
| 373 "\n" | |
| 374 " When false, the files in this target will be skipped by default.\n" | |
| 375 " This does not affect other targets that depend on the current target,\n" | |
| 376 " it just skips checking the includes of the current target's files.\n" | |
| 377 "\n" | |
| 378 "Example\n" | |
| 379 "\n" | |
| 380 " source_set(\"busted_includes\") {\n" | |
| 381 " # This target's includes are messed up, exclude it from checking.\n" | |
| 382 " check_includes = false\n" | |
| 383 " ...\n" | |
| 384 " }\n"; | |
| 385 | |
| 333 const char kConfigs[] = "configs"; | 386 const char kConfigs[] = "configs"; |
| 334 const char kConfigs_HelpShort[] = | 387 const char kConfigs_HelpShort[] = |
| 335 "configs: [label list] Configs applying to this target."; | 388 "configs: [label list] Configs applying to this target."; |
| 336 const char kConfigs_Help[] = | 389 const char kConfigs_Help[] = |
| 337 "configs: Configs applying to this target.\n" | 390 "configs: Configs applying to this target.\n" |
| 338 "\n" | 391 "\n" |
| 339 " A list of config labels.\n" | 392 " A list of config labels.\n" |
| 340 "\n" | 393 "\n" |
| 341 " The include_dirs, defines, etc. in each config are appended in the\n" | 394 " The include_dirs, defines, etc. in each config are appended in the\n" |
| 342 " order they appear to the compile command for each file in the target.\n" | 395 " order they appear to the compile command for each file in the target.\n" |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 844 INSERT_VARIABLE(TargetGenDir) | 897 INSERT_VARIABLE(TargetGenDir) |
| 845 INSERT_VARIABLE(TargetOutDir) | 898 INSERT_VARIABLE(TargetOutDir) |
| 846 } | 899 } |
| 847 return info_map; | 900 return info_map; |
| 848 } | 901 } |
| 849 | 902 |
| 850 const VariableInfoMap& GetTargetVariables() { | 903 const VariableInfoMap& GetTargetVariables() { |
| 851 static VariableInfoMap info_map; | 904 static VariableInfoMap info_map; |
| 852 if (info_map.empty()) { | 905 if (info_map.empty()) { |
| 853 INSERT_VARIABLE(AllDependentConfigs) | 906 INSERT_VARIABLE(AllDependentConfigs) |
| 907 INSERT_VARIABLE(AllowCircularIncludesFrom) | |
| 854 INSERT_VARIABLE(Args) | 908 INSERT_VARIABLE(Args) |
| 855 INSERT_VARIABLE(Cflags) | 909 INSERT_VARIABLE(Cflags) |
| 856 INSERT_VARIABLE(CflagsC) | 910 INSERT_VARIABLE(CflagsC) |
| 857 INSERT_VARIABLE(CflagsCC) | 911 INSERT_VARIABLE(CflagsCC) |
| 858 INSERT_VARIABLE(CflagsObjC) | 912 INSERT_VARIABLE(CflagsObjC) |
| 859 INSERT_VARIABLE(CflagsObjCC) | 913 INSERT_VARIABLE(CflagsObjCC) |
| 914 INSERT_VARIABLE(CheckIncludes) | |
| 860 INSERT_VARIABLE(Configs) | 915 INSERT_VARIABLE(Configs) |
| 861 INSERT_VARIABLE(Data) | 916 INSERT_VARIABLE(Data) |
| 862 INSERT_VARIABLE(Datadeps) | 917 INSERT_VARIABLE(Datadeps) |
| 863 INSERT_VARIABLE(Defines) | 918 INSERT_VARIABLE(Defines) |
| 864 INSERT_VARIABLE(Depfile) | 919 INSERT_VARIABLE(Depfile) |
| 865 INSERT_VARIABLE(Deps) | 920 INSERT_VARIABLE(Deps) |
| 866 INSERT_VARIABLE(DirectDependentConfigs) | 921 INSERT_VARIABLE(DirectDependentConfigs) |
| 867 INSERT_VARIABLE(ForwardDependentConfigsFrom) | 922 INSERT_VARIABLE(ForwardDependentConfigsFrom) |
| 868 INSERT_VARIABLE(IncludeDirs) | 923 INSERT_VARIABLE(IncludeDirs) |
| 869 INSERT_VARIABLE(Inputs) | 924 INSERT_VARIABLE(Inputs) |
| 870 INSERT_VARIABLE(Ldflags) | 925 INSERT_VARIABLE(Ldflags) |
| 871 INSERT_VARIABLE(Libs) | 926 INSERT_VARIABLE(Libs) |
| 872 INSERT_VARIABLE(LibDirs) | 927 INSERT_VARIABLE(LibDirs) |
| 873 INSERT_VARIABLE(OutputExtension) | 928 INSERT_VARIABLE(OutputExtension) |
| 874 INSERT_VARIABLE(OutputName) | 929 INSERT_VARIABLE(OutputName) |
| 875 INSERT_VARIABLE(Outputs) | 930 INSERT_VARIABLE(Outputs) |
| 876 INSERT_VARIABLE(Public) | 931 INSERT_VARIABLE(Public) |
| 877 INSERT_VARIABLE(Script) | 932 INSERT_VARIABLE(Script) |
| 878 INSERT_VARIABLE(Sources) | 933 INSERT_VARIABLE(Sources) |
| 879 INSERT_VARIABLE(Visibility) | 934 INSERT_VARIABLE(Visibility) |
| 880 } | 935 } |
| 881 return info_map; | 936 return info_map; |
| 882 } | 937 } |
| 883 | 938 |
| 884 #undef INSERT_VARIABLE | 939 #undef INSERT_VARIABLE |
| 885 | 940 |
| 886 } // namespace variables | 941 } // namespace variables |
| OLD | NEW |