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

Side by Side Diff: tools/gn/setup.cc

Issue 2481423002: Convert gn docstrings to C++11 raw strings. (Closed)
Patch Set: More Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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/setup.h" 5 #include "tools/gn/setup.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <sstream> 9 #include <sstream>
10 #include <utility> 10 #include <utility>
(...skipping 23 matching lines...) Expand all
34 #include "tools/gn/tokenizer.h" 34 #include "tools/gn/tokenizer.h"
35 #include "tools/gn/trace.h" 35 #include "tools/gn/trace.h"
36 #include "tools/gn/value.h" 36 #include "tools/gn/value.h"
37 #include "tools/gn/value_extractors.h" 37 #include "tools/gn/value_extractors.h"
38 38
39 #if defined(OS_WIN) 39 #if defined(OS_WIN)
40 #include <windows.h> 40 #include <windows.h>
41 #endif 41 #endif
42 42
43 extern const char kDotfile_Help[] = 43 extern const char kDotfile_Help[] =
44 ".gn file\n" 44 R"(.gn file
45 "\n" 45
46 " When gn starts, it will search the current directory and parent\n" 46 When gn starts, it will search the current directory and parent directories
47 " directories for a file called \".gn\". This indicates the source root.\n" 47 for a file called ".gn". This indicates the source root. You can override
48 " You can override this detection by using the --root command-line\n" 48 this detection by using the --root command-line argument
49 " argument\n" 49
50 "\n" 50 The .gn file in the source root will be executed. The syntax is the same as a
51 " The .gn file in the source root will be executed. The syntax is the\n" 51 buildfile, but with very limited build setup-specific meaning.
52 " same as a buildfile, but with very limited build setup-specific\n" 52
53 " meaning.\n" 53 If you specify --root, by default GN will look for the file .gn in that
54 "\n" 54 directory. If you want to specify a different file, you can additionally pass
55 " If you specify --root, by default GN will look for the file .gn in\n" 55 --dotfile:
56 " that directory. If you want to specify a different file, you can\n" 56
57 " additionally pass --dotfile:\n" 57 gn gen out/Debug --root=/home/build --dotfile=/home/my_gn_file.gn
58 "\n" 58
59 " gn gen out/Debug --root=/home/build --dotfile=/home/my_gn_file.gn\n" 59 Variables
60 "\n" 60
61 "Variables\n" 61 buildconfig [required]
62 "\n" 62 Label of the build config file. This file will be used to set up the
63 " buildconfig [required]\n" 63 build file execution environment for each toolchain.
64 " Label of the build config file. This file will be used to set up\n" 64
65 " the build file execution environment for each toolchain.\n" 65 check_targets [optional]
66 "\n" 66 A list of labels and label patterns that should be checked when running
67 " check_targets [optional]\n" 67 "gn check" or "gn gen --check". If unspecified, all targets will be
68 " A list of labels and label patterns that should be checked when\n" 68 checked. If it is the empty list, no targets will be checked.
69 " running \"gn check\" or \"gn gen --check\". If unspecified, all\n" 69
70 " targets will be checked. If it is the empty list, no targets will\n" 70 The format of this list is identical to that of "visibility" so see "gn
71 " be checked.\n" 71 help visibility" for examples.
72 "\n" 72
73 " The format of this list is identical to that of \"visibility\"\n" 73 exec_script_whitelist [optional]
74 " so see \"gn help visibility\" for examples.\n" 74 A list of .gn/.gni files (not labels) that have permission to call the
75 "\n" 75 exec_script function. If this list is defined, calls to exec_script will
76 " exec_script_whitelist [optional]\n" 76 be checked against this list and GN will fail if the current file isn't
77 " A list of .gn/.gni files (not labels) that have permission to call\n" 77 in the list.
78 " the exec_script function. If this list is defined, calls to\n" 78
79 " exec_script will be checked against this list and GN will fail if\n" 79 This is to allow the use of exec_script to be restricted since is easy to
80 " the current file isn't in the list.\n" 80 use inappropriately. Wildcards are not supported. Files in the
81 "\n" 81 secondary_source tree (if defined) should be referenced by ignoring the
82 " This is to allow the use of exec_script to be restricted since\n" 82 secondary tree and naming them as if they are in the main tree.
83 " is easy to use inappropriately. Wildcards are not supported.\n" 83
84 " Files in the secondary_source tree (if defined) should be\n" 84 If unspecified, the ability to call exec_script is unrestricted.
85 " referenced by ignoring the secondary tree and naming them as if\n" 85
86 " they are in the main tree.\n" 86 Example:
87 "\n" 87 exec_script_whitelist = [
88 " If unspecified, the ability to call exec_script is unrestricted.\n" 88 "//base/BUILD.gn",
89 "\n" 89 "//build/my_config.gni",
90 " Example:\n" 90 ]
91 " exec_script_whitelist = [\n" 91
92 " \"//base/BUILD.gn\",\n" 92 root [optional]
93 " \"//build/my_config.gni\",\n" 93 Label of the root build target. The GN build will start by loading the
94 " ]\n" 94 build file containing this target name. This defaults to "//:" which will
95 "\n" 95 cause the file //BUILD.gn to be loaded.
96 " root [optional]\n" 96
97 " Label of the root build target. The GN build will start by loading\n" 97 secondary_source [optional]
98 " the build file containing this target name. This defaults to\n" 98 Label of an alternate directory tree to find input files. When searching
99 " \"//:\" which will cause the file //BUILD.gn to be loaded.\n" 99 for a BUILD.gn file (or the build config file discussed above), the file
100 "\n" 100 will first be looked for in the source root. If it's not found, the
101 " secondary_source [optional]\n" 101 secondary source root will be checked (which would contain a parallel
102 " Label of an alternate directory tree to find input files. When\n" 102 directory hierarchy).
103 " searching for a BUILD.gn file (or the build config file discussed\n" 103
104 " above), the file will first be looked for in the source root.\n" 104 This behavior is intended to be used when BUILD.gn files can't be checked
105 " If it's not found, the secondary source root will be checked\n" 105 in to certain source directories for whatever reason.
106 " (which would contain a parallel directory hierarchy).\n" 106
107 "\n" 107 The secondary source root must be inside the main source tree.
108 " This behavior is intended to be used when BUILD.gn files can't be\n" 108
109 " checked in to certain source directories for whatever reason.\n" 109 Example .gn file contents
110 "\n" 110
111 " The secondary source root must be inside the main source tree.\n" 111 buildconfig = "//build/config/BUILDCONFIG.gn"
112 "\n" 112
113 "Example .gn file contents\n" 113 check_targets = [
114 "\n" 114 "//doom_melon/*", # Check everything in this subtree.
115 " buildconfig = \"//build/config/BUILDCONFIG.gn\"\n" 115 "//tools:mind_controlling_ant", # Check this specific target.
116 "\n" 116 ]
117 " check_targets = [\n" 117
118 " \"//doom_melon/*\", # Check everything in this subtree.\n" 118 root = "//:root"
119 " \"//tools:mind_controlling_ant\", # Check this specific target.\n" 119
120 " ]\n" 120 secondary_source = "//build/config/temporary_buildfiles/")";
scottmg 2016/11/08 01:01:46 here
121 "\n"
122 " root = \"//:root\"\n"
123 "\n"
124 " secondary_source = \"//build/config/temporary_buildfiles/\"\n";
125 121
126 namespace { 122 namespace {
127 123
128 const base::FilePath::CharType kGnFile[] = FILE_PATH_LITERAL(".gn"); 124 const base::FilePath::CharType kGnFile[] = FILE_PATH_LITERAL(".gn");
129 125
130 base::FilePath FindDotFile(const base::FilePath& current_dir) { 126 base::FilePath FindDotFile(const base::FilePath& current_dir) {
131 base::FilePath try_this_file = current_dir.Append(kGnFile); 127 base::FilePath try_this_file = current_dir.Append(kGnFile);
132 if (base::PathExists(try_this_file)) 128 if (base::PathExists(try_this_file))
133 return try_this_file; 129 return try_this_file;
134 130
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 if (err.has_error()) { 734 if (err.has_error()) {
739 err.PrintToStdout(); 735 err.PrintToStdout();
740 return false; 736 return false;
741 } 737 }
742 } 738 }
743 build_settings_.set_exec_script_whitelist(std::move(whitelist)); 739 build_settings_.set_exec_script_whitelist(std::move(whitelist));
744 } 740 }
745 741
746 return true; 742 return true;
747 } 743 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698