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 #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" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "tools/gn/build_settings.h" | 14 #include "tools/gn/build_settings.h" |
15 #include "tools/gn/builder.h" | 15 #include "tools/gn/builder.h" |
16 #include "tools/gn/loader.h" | 16 #include "tools/gn/loader.h" |
17 #include "tools/gn/scheduler.h" | 17 #include "tools/gn/scheduler.h" |
18 #include "tools/gn/scope.h" | 18 #include "tools/gn/scope.h" |
19 #include "tools/gn/settings.h" | 19 #include "tools/gn/settings.h" |
20 #include "tools/gn/token.h" | 20 #include "tools/gn/token.h" |
21 #include "tools/gn/toolchain.h" | 21 #include "tools/gn/toolchain.h" |
22 | 22 |
23 class CommandLine; | |
24 class InputFile; | 23 class InputFile; |
25 class ParseNode; | 24 class ParseNode; |
26 | 25 |
| 26 namespace base { |
| 27 class CommandLine; |
| 28 } |
| 29 |
27 extern const char kDotfile_Help[]; | 30 extern const char kDotfile_Help[]; |
28 | 31 |
29 // Base class for code shared between Setup and DependentSetup. | 32 // Base class for code shared between Setup and DependentSetup. |
30 class CommonSetup { | 33 class CommonSetup { |
31 public: | 34 public: |
32 virtual ~CommonSetup(); | 35 virtual ~CommonSetup(); |
33 | 36 |
34 // Returns the scheduler. This is virtual since only the main setup has a | 37 // Returns the scheduler. This is virtual since only the main setup has a |
35 // scheduler and the derived ones just store pointers. | 38 // scheduler and the derived ones just store pointers. |
36 virtual Scheduler* GetScheduler() = 0; | 39 virtual Scheduler* GetScheduler() = 0; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // and returns false. This includes both RunPreMessageLoop() and | 91 // and returns false. This includes both RunPreMessageLoop() and |
89 // RunPostMessageLoop(). | 92 // RunPostMessageLoop(). |
90 bool Run(); | 93 bool Run(); |
91 | 94 |
92 Scheduler& scheduler() { return scheduler_; } | 95 Scheduler& scheduler() { return scheduler_; } |
93 | 96 |
94 virtual Scheduler* GetScheduler() OVERRIDE; | 97 virtual Scheduler* GetScheduler() OVERRIDE; |
95 | 98 |
96 private: | 99 private: |
97 // Fills build arguments. Returns true on success. | 100 // Fills build arguments. Returns true on success. |
98 bool FillArguments(const CommandLine& cmdline); | 101 bool FillArguments(const base::CommandLine& cmdline); |
99 | 102 |
100 // Fills the root directory into the settings. Returns true on success. | 103 // Fills the root directory into the settings. Returns true on success. |
101 bool FillSourceDir(const CommandLine& cmdline); | 104 bool FillSourceDir(const base::CommandLine& cmdline); |
102 | 105 |
103 // Fills the build directory given the value the user has specified. | 106 // Fills the build directory given the value the user has specified. |
104 // Must happen after FillSourceDir so we can resolve source-relative | 107 // Must happen after FillSourceDir so we can resolve source-relative |
105 // paths. | 108 // paths. |
106 bool FillBuildDir(const std::string& build_dir); | 109 bool FillBuildDir(const std::string& build_dir); |
107 | 110 |
108 // Fills the python path portion of the command line. On failure, sets | 111 // Fills the python path portion of the command line. On failure, sets |
109 // it to just "python". | 112 // it to just "python". |
110 void FillPythonPath(); | 113 void FillPythonPath(); |
111 | 114 |
112 // Run config file. | 115 // Run config file. |
113 bool RunConfigFile(); | 116 bool RunConfigFile(); |
114 | 117 |
115 bool FillOtherConfig(const CommandLine& cmdline); | 118 bool FillOtherConfig(const base::CommandLine& cmdline); |
116 | 119 |
117 Scheduler scheduler_; | 120 Scheduler scheduler_; |
118 | 121 |
119 // These empty settings and toolchain are used to interpret the command line | 122 // These empty settings and toolchain are used to interpret the command line |
120 // and dot file. | 123 // and dot file. |
121 BuildSettings empty_build_settings_; | 124 BuildSettings empty_build_settings_; |
122 Settings empty_settings_; | 125 Settings empty_settings_; |
123 Scope dotfile_scope_; | 126 Scope dotfile_scope_; |
124 | 127 |
125 // State for invoking the dotfile. | 128 // State for invoking the dotfile. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void RunPreMessageLoop(); | 164 void RunPreMessageLoop(); |
162 bool RunPostMessageLoop(); | 165 bool RunPostMessageLoop(); |
163 | 166 |
164 virtual Scheduler* GetScheduler() OVERRIDE; | 167 virtual Scheduler* GetScheduler() OVERRIDE; |
165 | 168 |
166 private: | 169 private: |
167 Scheduler* scheduler_; | 170 Scheduler* scheduler_; |
168 }; | 171 }; |
169 | 172 |
170 #endif // TOOLS_GN_SETUP_H_ | 173 #endif // TOOLS_GN_SETUP_H_ |
OLD | NEW |