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

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

Issue 265693003: Redo GN "args" command (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: windows Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
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 #ifndef TOOLS_GN_SETUP_H_ 5 #ifndef TOOLS_GN_SETUP_H_
6 #define TOOLS_GN_SETUP_H_ 6 #define TOOLS_GN_SETUP_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // After a successful run, setting this will additionally cause the public 51 // After a successful run, setting this will additionally cause the public
52 // headers to be checked. Defaults to false. 52 // headers to be checked. Defaults to false.
53 void set_check_public_headers(bool s) { 53 void set_check_public_headers(bool s) {
54 check_public_headers_ = s; 54 check_public_headers_ = s;
55 } 55 }
56 56
57 BuildSettings& build_settings() { return build_settings_; } 57 BuildSettings& build_settings() { return build_settings_; }
58 Builder* builder() { return builder_.get(); } 58 Builder* builder() { return builder_.get(); }
59 LoaderImpl* loader() { return loader_.get(); } 59 LoaderImpl* loader() { return loader_.get(); }
60 60
61 // Name of the file in the root build directory that contains the build
62 // arguements.
63 static const char kBuildArgFileName[];
64
61 protected: 65 protected:
62 CommonSetup(); 66 CommonSetup();
63 CommonSetup(const CommonSetup& other); 67 CommonSetup(const CommonSetup& other);
64 68
65 // Performs the two sets of operations to run the generation before and after 69 // Performs the two sets of operations to run the generation before and after
66 // the message loop is run. 70 // the message loop is run.
67 void RunPreMessageLoop(); 71 void RunPreMessageLoop();
68 bool RunPostMessageLoop(); 72 bool RunPostMessageLoop();
69 73
70 BuildSettings build_settings_; 74 BuildSettings build_settings_;
(...skipping 27 matching lines...) Expand all
98 102
99 // Runs the load, returning true on success. On failure, prints the error 103 // Runs the load, returning true on success. On failure, prints the error
100 // and returns false. This includes both RunPreMessageLoop() and 104 // and returns false. This includes both RunPreMessageLoop() and
101 // RunPostMessageLoop(). 105 // RunPostMessageLoop().
102 bool Run(); 106 bool Run();
103 107
104 Scheduler& scheduler() { return scheduler_; } 108 Scheduler& scheduler() { return scheduler_; }
105 109
106 virtual Scheduler* GetScheduler() OVERRIDE; 110 virtual Scheduler* GetScheduler() OVERRIDE;
107 111
112 // Returns the file used to store the build arguments. Note that the path
113 // might not exist.
114 SourceFile GetBuildArgFile() const;
115
116 // Sets whether the build arguments should be filled during setup from the
117 // command line/build argument file. This will be true by default. The use
118 // case for setting it to false is when editing build arguments, we don't
119 // want to rely on them being valid.
120 void set_fill_arguments(bool fa) { fill_arguments_ = fa; }
121
108 private: 122 private:
109 // Fills build arguments. Returns true on success. 123 // Fills build arguments. Returns true on success.
110 bool FillArguments(const base::CommandLine& cmdline); 124 bool FillArguments(const base::CommandLine& cmdline);
111 125
126 // Fills the build arguments from the command line or from the build arg file.
127 bool FillArgsFromCommandLine(const std::string& args);
128 bool FillArgsFromFile();
129
130 // Given an already-loaded args_input_file_, parses and saves the resulting
131 // arguments. Backend for the different FillArgs variants.
132 bool FillArgsFromArgsInputFile();
133
134 // Writes the build arguments to the build arg file.
135 bool SaveArgsToFile();
136
112 // Fills the root directory into the settings. Returns true on success. 137 // Fills the root directory into the settings. Returns true on success.
113 bool FillSourceDir(const base::CommandLine& cmdline); 138 bool FillSourceDir(const base::CommandLine& cmdline);
114 139
115 // Fills the build directory given the value the user has specified. 140 // Fills the build directory given the value the user has specified.
116 // Must happen after FillSourceDir so we can resolve source-relative 141 // Must happen after FillSourceDir so we can resolve source-relative
117 // paths. 142 // paths.
118 bool FillBuildDir(const std::string& build_dir); 143 bool FillBuildDir(const std::string& build_dir);
119 144
120 // Fills the python path portion of the command line. On failure, sets 145 // Fills the python path portion of the command line. On failure, sets
121 // it to just "python". 146 // it to just "python".
(...skipping 11 matching lines...) Expand all
133 BuildSettings empty_build_settings_; 158 BuildSettings empty_build_settings_;
134 Settings empty_settings_; 159 Settings empty_settings_;
135 Scope dotfile_scope_; 160 Scope dotfile_scope_;
136 161
137 // State for invoking the dotfile. 162 // State for invoking the dotfile.
138 base::FilePath dotfile_name_; 163 base::FilePath dotfile_name_;
139 scoped_ptr<InputFile> dotfile_input_file_; 164 scoped_ptr<InputFile> dotfile_input_file_;
140 std::vector<Token> dotfile_tokens_; 165 std::vector<Token> dotfile_tokens_;
141 scoped_ptr<ParseNode> dotfile_root_; 166 scoped_ptr<ParseNode> dotfile_root_;
142 167
168 // Set to true when we should populate the build arguments from the command
169 // line or build argument file. See setter above.
170 bool fill_arguments_;
171
143 // State for invoking the command line args. We specifically want to keep 172 // State for invoking the command line args. We specifically want to keep
144 // this around for the entire run so that Values can blame to the command 173 // this around for the entire run so that Values can blame to the command
145 // line when we issue errors about them. 174 // line when we issue errors about them.
146 scoped_ptr<InputFile> args_input_file_; 175 scoped_ptr<InputFile> args_input_file_;
147 std::vector<Token> args_tokens_; 176 std::vector<Token> args_tokens_;
148 scoped_ptr<ParseNode> args_root_; 177 scoped_ptr<ParseNode> args_root_;
149 178
150 DISALLOW_COPY_AND_ASSIGN(Setup); 179 DISALLOW_COPY_AND_ASSIGN(Setup);
151 }; 180 };
152 181
(...skipping 20 matching lines...) Expand all
173 void RunPreMessageLoop(); 202 void RunPreMessageLoop();
174 bool RunPostMessageLoop(); 203 bool RunPostMessageLoop();
175 204
176 virtual Scheduler* GetScheduler() OVERRIDE; 205 virtual Scheduler* GetScheduler() OVERRIDE;
177 206
178 private: 207 private:
179 Scheduler* scheduler_; 208 Scheduler* scheduler_;
180 }; 209 };
181 210
182 #endif // TOOLS_GN_SETUP_H_ 211 #endif // TOOLS_GN_SETUP_H_
OLDNEW
« tools/gn/args.cc ('K') | « tools/gn/ninja_build_writer.cc ('k') | tools/gn/setup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698