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

Unified Diff: tools/gn/setup.h

Issue 265693003: Redo GN "args" command (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
Index: tools/gn/setup.h
diff --git a/tools/gn/setup.h b/tools/gn/setup.h
index eb9d37b2b445288700335c0b6e3af8fdacdd1d3b..0cd0a7930a1cf6a1ab9b2e93b4041ec0e1aa8dc6 100644
--- a/tools/gn/setup.h
+++ b/tools/gn/setup.h
@@ -58,6 +58,10 @@ class CommonSetup {
Builder* builder() { return builder_.get(); }
LoaderImpl* loader() { return loader_.get(); }
+ // Name of the file in the root build directory that contains the build
+ // arguements.
+ static const char kBuildArgFileName[];
+
protected:
CommonSetup();
CommonSetup(const CommonSetup& other);
@@ -105,10 +109,31 @@ class Setup : public CommonSetup {
virtual Scheduler* GetScheduler() OVERRIDE;
+ // Returns the file used to store the build arguments. Note that the path
+ // might not exist.
+ SourceFile GetBuildArgFile() const;
+
+ // Sets whether the build arguments should be filled during setup from the
+ // command line/build argument file. This will be true by default. The use
+ // case for setting it to false is when editing build arguments, we don't
+ // want to rely on them being valid.
+ void set_fill_arguments(bool fa) { fill_arguments_ = fa; }
+
private:
// Fills build arguments. Returns true on success.
bool FillArguments(const base::CommandLine& cmdline);
+ // Fills the build arguments from the command line or from the build arg file.
+ bool FillArgsFromCommandLine(const std::string& args);
+ bool FillArgsFromFile();
+
+ // Given an already-loaded args_input_file_, parses and saves the resulting
+ // arguments. Backend for the different FillArgs variants.
+ bool FillArgsFromArgsInputFile();
+
+ // Writes the build arguments to the build arg file.
+ bool SaveArgsToFile();
+
// Fills the root directory into the settings. Returns true on success.
bool FillSourceDir(const base::CommandLine& cmdline);
@@ -140,6 +165,10 @@ class Setup : public CommonSetup {
std::vector<Token> dotfile_tokens_;
scoped_ptr<ParseNode> dotfile_root_;
+ // Set to true when we should populate the build arguments from the command
+ // line or build argument file. See setter above.
+ bool fill_arguments_;
+
// State for invoking the command line args. We specifically want to keep
// this around for the entire run so that Values can blame to the command
// line when we issue errors about them.

Powered by Google App Engine
This is Rietveld 408576698