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_BUILD_SETTINGS_H_ | 5 #ifndef TOOLS_GN_BUILD_SETTINGS_H_ |
6 #define TOOLS_GN_BUILD_SETTINGS_H_ | 6 #define TOOLS_GN_BUILD_SETTINGS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "tools/gn/args.h" | 16 #include "tools/gn/args.h" |
| 17 #include "tools/gn/label.h" |
17 #include "tools/gn/scope.h" | 18 #include "tools/gn/scope.h" |
18 #include "tools/gn/source_dir.h" | 19 #include "tools/gn/source_dir.h" |
19 #include "tools/gn/source_file.h" | 20 #include "tools/gn/source_file.h" |
20 | 21 |
21 class Item; | 22 class Item; |
22 | 23 |
23 // Settings for one build, which is one toplevel output directory. There | 24 // Settings for one build, which is one toplevel output directory. There |
24 // may be multiple Settings objects that refer to this, one for each toolchain. | 25 // may be multiple Settings objects that refer to this, one for each toolchain. |
25 class BuildSettings { | 26 class BuildSettings { |
26 public: | 27 public: |
27 typedef base::Callback<void(std::unique_ptr<Item>)> ItemDefinedCallback; | 28 typedef base::Callback<void(std::unique_ptr<Item>)> ItemDefinedCallback; |
28 typedef base::Callback<void(const std::string&)> PrintCallback; | 29 typedef base::Callback<void(const std::string&)> PrintCallback; |
29 | 30 |
30 BuildSettings(); | 31 BuildSettings(); |
31 BuildSettings(const BuildSettings& other); | 32 BuildSettings(const BuildSettings& other); |
32 ~BuildSettings(); | 33 ~BuildSettings(); |
33 | 34 |
| 35 // Root target label. |
| 36 const Label& root_target_label() const { return root_target_label_; } |
| 37 void SetRootTargetLabel(const Label& r); |
| 38 |
34 // Absolute path of the source root on the local system. Everything is | 39 // Absolute path of the source root on the local system. Everything is |
35 // relative to this. Does not end in a [back]slash. | 40 // relative to this. Does not end in a [back]slash. |
36 const base::FilePath& root_path() const { return root_path_; } | 41 const base::FilePath& root_path() const { return root_path_; } |
37 const std::string& root_path_utf8() const { return root_path_utf8_; } | 42 const std::string& root_path_utf8() const { return root_path_utf8_; } |
38 void SetRootPath(const base::FilePath& r); | 43 void SetRootPath(const base::FilePath& r); |
39 | 44 |
40 // When nonempty, specifies a parallel directory higherarchy in which to | 45 // When nonempty, specifies a parallel directory higherarchy in which to |
41 // search for buildfiles if they're not found in the root higherarchy. This | 46 // search for buildfiles if they're not found in the root higherarchy. This |
42 // allows us to keep buildfiles in a separate tree during development. | 47 // allows us to keep buildfiles in a separate tree during development. |
43 const base::FilePath& secondary_source_path() const { | 48 const base::FilePath& secondary_source_path() const { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // A list of files that can call exec_script(). If the returned pointer is | 102 // A list of files that can call exec_script(). If the returned pointer is |
98 // null, exec_script may be called from anywhere. | 103 // null, exec_script may be called from anywhere. |
99 const std::set<SourceFile>* exec_script_whitelist() const { | 104 const std::set<SourceFile>* exec_script_whitelist() const { |
100 return exec_script_whitelist_.get(); | 105 return exec_script_whitelist_.get(); |
101 } | 106 } |
102 void set_exec_script_whitelist(std::unique_ptr<std::set<SourceFile>> list) { | 107 void set_exec_script_whitelist(std::unique_ptr<std::set<SourceFile>> list) { |
103 exec_script_whitelist_ = std::move(list); | 108 exec_script_whitelist_ = std::move(list); |
104 } | 109 } |
105 | 110 |
106 private: | 111 private: |
| 112 Label root_target_label_; |
107 base::FilePath root_path_; | 113 base::FilePath root_path_; |
108 std::string root_path_utf8_; | 114 std::string root_path_utf8_; |
109 base::FilePath secondary_source_path_; | 115 base::FilePath secondary_source_path_; |
110 base::FilePath python_path_; | 116 base::FilePath python_path_; |
111 | 117 |
112 SourceFile build_config_file_; | 118 SourceFile build_config_file_; |
113 SourceFile arg_file_template_path_; | 119 SourceFile arg_file_template_path_; |
114 SourceDir build_dir_; | 120 SourceDir build_dir_; |
115 Args build_args_; | 121 Args build_args_; |
116 | 122 |
117 ItemDefinedCallback item_defined_callback_; | 123 ItemDefinedCallback item_defined_callback_; |
118 PrintCallback print_callback_; | 124 PrintCallback print_callback_; |
119 | 125 |
120 std::unique_ptr<std::set<SourceFile>> exec_script_whitelist_; | 126 std::unique_ptr<std::set<SourceFile>> exec_script_whitelist_; |
121 | 127 |
122 BuildSettings& operator=(const BuildSettings& other); // Disallow. | 128 BuildSettings& operator=(const BuildSettings& other); // Disallow. |
123 }; | 129 }; |
124 | 130 |
125 #endif // TOOLS_GN_BUILD_SETTINGS_H_ | 131 #endif // TOOLS_GN_BUILD_SETTINGS_H_ |
OLD | NEW |