| 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" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 CommonSetup& operator=(const CommonSetup& other); // Disallow. | 85 CommonSetup& operator=(const CommonSetup& other); // Disallow. |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 // Helper class to setup the build settings and environment for the various | 88 // Helper class to setup the build settings and environment for the various |
| 89 // commands to run. | 89 // commands to run. |
| 90 class Setup : public CommonSetup { | 90 class Setup : public CommonSetup { |
| 91 public: | 91 public: |
| 92 Setup(); | 92 Setup(); |
| 93 virtual ~Setup(); | 93 ~Setup() override; |
| 94 | 94 |
| 95 // Configures the build for the current command line. On success returns | 95 // Configures the build for the current command line. On success returns |
| 96 // true. On failure, prints the error and returns false. | 96 // true. On failure, prints the error and returns false. |
| 97 // | 97 // |
| 98 // The parameter is the string the user specified for the build directory. We | 98 // The parameter is the string the user specified for the build directory. We |
| 99 // will try to interpret this as a SourceDir if possible, and will fail if is | 99 // will try to interpret this as a SourceDir if possible, and will fail if is |
| 100 // is malformed. | 100 // is malformed. |
| 101 // | 101 // |
| 102 // With force_create = false, setup will fail if the build directory doesn't | 102 // With force_create = false, setup will fail if the build directory doesn't |
| 103 // alreay exist with an args file in it. With force_create set to true, the | 103 // alreay exist with an args file in it. With force_create set to true, the |
| 104 // directory will be created if necessary. Commands explicitly doing | 104 // directory will be created if necessary. Commands explicitly doing |
| 105 // generation should set this to true to create it, but querying commands | 105 // generation should set this to true to create it, but querying commands |
| 106 // should set it to false to prevent creating oddly-named directories in case | 106 // should set it to false to prevent creating oddly-named directories in case |
| 107 // the user omits the build directory argument (which is easy to do). | 107 // the user omits the build directory argument (which is easy to do). |
| 108 bool DoSetup(const std::string& build_dir, bool force_create); | 108 bool DoSetup(const std::string& build_dir, bool force_create); |
| 109 | 109 |
| 110 // Runs the load, returning true on success. On failure, prints the error | 110 // Runs the load, returning true on success. On failure, prints the error |
| 111 // and returns false. This includes both RunPreMessageLoop() and | 111 // and returns false. This includes both RunPreMessageLoop() and |
| 112 // RunPostMessageLoop(). | 112 // RunPostMessageLoop(). |
| 113 bool Run(); | 113 bool Run(); |
| 114 | 114 |
| 115 Scheduler& scheduler() { return scheduler_; } | 115 Scheduler& scheduler() { return scheduler_; } |
| 116 | 116 |
| 117 virtual Scheduler* GetScheduler() OVERRIDE; | 117 Scheduler* GetScheduler() OVERRIDE; |
| 118 | 118 |
| 119 // Returns the file used to store the build arguments. Note that the path | 119 // Returns the file used to store the build arguments. Note that the path |
| 120 // might not exist. | 120 // might not exist. |
| 121 SourceFile GetBuildArgFile() const; | 121 SourceFile GetBuildArgFile() const; |
| 122 | 122 |
| 123 // Sets whether the build arguments should be filled during setup from the | 123 // Sets whether the build arguments should be filled during setup from the |
| 124 // command line/build argument file. This will be true by default. The use | 124 // command line/build argument file. This will be true by default. The use |
| 125 // case for setting it to false is when editing build arguments, we don't | 125 // case for setting it to false is when editing build arguments, we don't |
| 126 // want to rely on them being valid. | 126 // want to rely on them being valid. |
| 127 void set_fill_arguments(bool fa) { fill_arguments_ = fa; } | 127 void set_fill_arguments(bool fa) { fill_arguments_ = fa; } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // main_setup.Run(); | 195 // main_setup.Run(); |
| 196 // dependent_setup.RunPostMessageLoop(); | 196 // dependent_setup.RunPostMessageLoop(); |
| 197 // so that the main setup executes the message loop, but both are run. | 197 // so that the main setup executes the message loop, but both are run. |
| 198 class DependentSetup : public CommonSetup { | 198 class DependentSetup : public CommonSetup { |
| 199 public: | 199 public: |
| 200 // Note: this could be one function that takes a CommonSetup*, but then | 200 // Note: this could be one function that takes a CommonSetup*, but then |
| 201 // the compiler can get confused what to call, since it also matches the | 201 // the compiler can get confused what to call, since it also matches the |
| 202 // default copy constructor. | 202 // default copy constructor. |
| 203 DependentSetup(Setup* derive_from); | 203 DependentSetup(Setup* derive_from); |
| 204 DependentSetup(DependentSetup* derive_from); | 204 DependentSetup(DependentSetup* derive_from); |
| 205 virtual ~DependentSetup(); | 205 ~DependentSetup() override; |
| 206 | 206 |
| 207 // These are the two parts of Run() in the regular setup, not including the | 207 // These are the two parts of Run() in the regular setup, not including the |
| 208 // call to actually run the message loop. | 208 // call to actually run the message loop. |
| 209 void RunPreMessageLoop(); | 209 void RunPreMessageLoop(); |
| 210 bool RunPostMessageLoop(); | 210 bool RunPostMessageLoop(); |
| 211 | 211 |
| 212 virtual Scheduler* GetScheduler() OVERRIDE; | 212 Scheduler* GetScheduler() OVERRIDE; |
| 213 | 213 |
| 214 private: | 214 private: |
| 215 Scheduler* scheduler_; | 215 Scheduler* scheduler_; |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 #endif // TOOLS_GN_SETUP_H_ | 218 #endif // TOOLS_GN_SETUP_H_ |
| OLD | NEW |