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_BUILDER_H_ | 5 #ifndef TOOLS_GN_BUILDER_H_ |
6 #define TOOLS_GN_BUILDER_H_ | 6 #define TOOLS_GN_BUILDER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "tools/gn/builder_record.h" | 12 #include "tools/gn/builder_record.h" |
13 #include "tools/gn/label.h" | 13 #include "tools/gn/label.h" |
14 #include "tools/gn/label_ptr.h" | 14 #include "tools/gn/label_ptr.h" |
15 #include "tools/gn/unique_vector.h" | 15 #include "tools/gn/unique_vector.h" |
16 | 16 |
| 17 class ActionValues; |
17 class Err; | 18 class Err; |
18 class Loader; | 19 class Loader; |
19 class ParseNode; | 20 class ParseNode; |
20 | 21 |
21 // The builder assembles the dependency tree. It is not threadsafe and runs on | 22 // The builder assembles the dependency tree. It is not threadsafe and runs on |
22 // the main thread only. See also BuilderRecord. | 23 // the main thread only. See also BuilderRecord. |
23 class Builder { | 24 class Builder { |
24 public: | 25 public: |
25 typedef base::Callback<void(const BuilderRecord*)> ResolvedGeneratedCallback; | 26 typedef base::Callback<void(const BuilderRecord*)> ResolvedGeneratedCallback; |
26 | 27 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 111 |
111 // This takes a BuilderRecord with resolved depdencies, and fills in the | 112 // This takes a BuilderRecord with resolved depdencies, and fills in the |
112 // target's Label*Vectors with the resolved pointers. | 113 // target's Label*Vectors with the resolved pointers. |
113 bool ResolveItem(BuilderRecord* record, Err* err); | 114 bool ResolveItem(BuilderRecord* record, Err* err); |
114 | 115 |
115 // Fills in the pointers in the given vector based on the labels. We assume | 116 // Fills in the pointers in the given vector based on the labels. We assume |
116 // that everything should be resolved by this point, so will return an error | 117 // that everything should be resolved by this point, so will return an error |
117 // if anything isn't found or if the type doesn't match. | 118 // if anything isn't found or if the type doesn't match. |
118 bool ResolveDeps(LabelTargetVector* deps, Err* err); | 119 bool ResolveDeps(LabelTargetVector* deps, Err* err); |
119 bool ResolveConfigs(UniqueVector<LabelConfigPair>* configs, Err* err); | 120 bool ResolveConfigs(UniqueVector<LabelConfigPair>* configs, Err* err); |
| 121 bool ResolveActionValues(ActionValues* action_values, Err* err); |
120 bool ResolveToolchain(Target* target, Err* err); | 122 bool ResolveToolchain(Target* target, Err* err); |
121 bool ResolvePools(Toolchain* toolchain, Err* err); | 123 bool ResolvePools(Toolchain* toolchain, Err* err); |
122 | 124 |
123 // Given a list of unresolved records, tries to find any circular | 125 // Given a list of unresolved records, tries to find any circular |
124 // dependencies and returns the string describing the problem. If no circular | 126 // dependencies and returns the string describing the problem. If no circular |
125 // deps were found, returns the empty string. | 127 // deps were found, returns the empty string. |
126 std::string CheckForCircularDependencies( | 128 std::string CheckForCircularDependencies( |
127 const std::vector<const BuilderRecord*>& bad_records) const; | 129 const std::vector<const BuilderRecord*>& bad_records) const; |
128 | 130 |
129 // Non owning pointer. | 131 // Non owning pointer. |
130 Loader* loader_; | 132 Loader* loader_; |
131 | 133 |
132 // Owning pointers. | 134 // Owning pointers. |
133 typedef std::map<Label, BuilderRecord*> RecordMap; | 135 typedef std::map<Label, BuilderRecord*> RecordMap; |
134 RecordMap records_; | 136 RecordMap records_; |
135 | 137 |
136 ResolvedGeneratedCallback resolved_and_generated_callback_; | 138 ResolvedGeneratedCallback resolved_and_generated_callback_; |
137 | 139 |
138 DISALLOW_COPY_AND_ASSIGN(Builder); | 140 DISALLOW_COPY_AND_ASSIGN(Builder); |
139 }; | 141 }; |
140 | 142 |
141 #endif // TOOLS_GN_BUILDER_H_ | 143 #endif // TOOLS_GN_BUILDER_H_ |
OLD | NEW |