OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef TOOLS_GN_SETUP_H_ |
| 6 #define TOOLS_GN_SETUP_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "tools/gn/build_settings.h" |
| 14 #include "tools/gn/scheduler.h" |
| 15 #include "tools/gn/scope.h" |
| 16 #include "tools/gn/settings.h" |
| 17 #include "tools/gn/token.h" |
| 18 #include "tools/gn/toolchain.h" |
| 19 |
| 20 class CommandLine; |
| 21 class InputFile; |
| 22 class ParseNode; |
| 23 |
| 24 // Helper class to setup the build settings and environment for the various |
| 25 // commands to run. |
| 26 class Setup { |
| 27 public: |
| 28 Setup(); |
| 29 ~Setup(); |
| 30 |
| 31 // Configures the build for the current command line. On success returns |
| 32 // true. On failure, prints the error and returns false. |
| 33 bool DoSetup(); |
| 34 |
| 35 // Runs the load, returning true on success. On failure, prints the error |
| 36 // and returns false. |
| 37 bool Run(); |
| 38 |
| 39 BuildSettings& build_settings() { return build_settings_; } |
| 40 Scheduler& scheduler() { return scheduler_; } |
| 41 |
| 42 private: |
| 43 // Fills the root directory into the settings. Returns true on success. |
| 44 bool FillSourceDir(const CommandLine& cmdline); |
| 45 |
| 46 // Run config file. |
| 47 bool RunConfigFile(); |
| 48 |
| 49 bool FillOtherConfig(const CommandLine& cmdline); |
| 50 |
| 51 BuildSettings build_settings_; |
| 52 Scheduler scheduler_; |
| 53 |
| 54 // State for invoking the dotfile. |
| 55 // TODO(brettw) this seems a bit excessive, maybe we can get this down |
| 56 // somehow? |
| 57 base::FilePath dotfile_name_; |
| 58 scoped_ptr<InputFile> dotfile_input_file_; |
| 59 std::vector<Token> dotfile_tokens_; |
| 60 scoped_ptr<ParseNode> dotfile_root_; |
| 61 BuildSettings dotfile_build_settings_; |
| 62 Toolchain dotfile_toolchain_; |
| 63 Settings dotfile_settings_; |
| 64 Scope dotfile_scope_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(Setup); |
| 67 }; |
| 68 |
| 69 #endif // TOOLS_GN_SETUP_H_ |
OLD | NEW |