Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(616)

Side by Side Diff: tools/gn/builder.h

Issue 2926013002: Support explicit pools in actions (Closed)
Patch Set: Remove console altogether Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/action_values.cc ('k') | tools/gn/builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 84
84 bool AddDeps(BuilderRecord* record, 85 bool AddDeps(BuilderRecord* record,
85 const LabelConfigVector& configs, 86 const LabelConfigVector& configs,
86 Err* err); 87 Err* err);
87 bool AddDeps(BuilderRecord* record, 88 bool AddDeps(BuilderRecord* record,
88 const UniqueVector<LabelConfigPair>& configs, 89 const UniqueVector<LabelConfigPair>& configs,
89 Err* err); 90 Err* err);
90 bool AddDeps(BuilderRecord* record, 91 bool AddDeps(BuilderRecord* record,
91 const LabelTargetVector& targets, 92 const LabelTargetVector& targets,
92 Err* err); 93 Err* err);
94 bool AddActionValuesDep(BuilderRecord* record,
95 const ActionValues& action_values,
96 Err* err);
93 bool AddToolchainDep(BuilderRecord* record, 97 bool AddToolchainDep(BuilderRecord* record,
94 const Target* target, 98 const Target* target,
95 Err* err); 99 Err* err);
96 100
97 // Given a target, sets the "should generate" bit and pushes it through the 101 // Given a target, sets the "should generate" bit and pushes it through the
98 // dependency tree. Any time the bit it set, we ensure that the given item is 102 // dependency tree. Any time the bit it set, we ensure that the given item is
99 // scheduled to be loaded. 103 // scheduled to be loaded.
100 // 104 //
101 // If the force flag is set, we'll ignore the current state of the record's 105 // If the force flag is set, we'll ignore the current state of the record's
102 // should_generate flag, and set it on the dependents every time. This is 106 // should_generate flag, and set it on the dependents every time. This is
103 // used when defining a target: the "should generate" may have been set 107 // used when defining a target: the "should generate" may have been set
104 // before the item was defined (if it is required by something that is 108 // before the item was defined (if it is required by something that is
105 // required). In this case, we need to re-push the "should generate" flag 109 // required). In this case, we need to re-push the "should generate" flag
106 // to the item's dependencies. 110 // to the item's dependencies.
107 void RecursiveSetShouldGenerate(BuilderRecord* record, bool force); 111 void RecursiveSetShouldGenerate(BuilderRecord* record, bool force);
108 112
109 void ScheduleItemLoadIfNecessary(BuilderRecord* record); 113 void ScheduleItemLoadIfNecessary(BuilderRecord* record);
110 114
111 // This takes a BuilderRecord with resolved depdencies, and fills in the 115 // This takes a BuilderRecord with resolved depdencies, and fills in the
112 // target's Label*Vectors with the resolved pointers. 116 // target's Label*Vectors with the resolved pointers.
113 bool ResolveItem(BuilderRecord* record, Err* err); 117 bool ResolveItem(BuilderRecord* record, Err* err);
114 118
115 // Fills in the pointers in the given vector based on the labels. We assume 119 // 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 120 // 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. 121 // if anything isn't found or if the type doesn't match.
118 bool ResolveDeps(LabelTargetVector* deps, Err* err); 122 bool ResolveDeps(LabelTargetVector* deps, Err* err);
119 bool ResolveConfigs(UniqueVector<LabelConfigPair>* configs, Err* err); 123 bool ResolveConfigs(UniqueVector<LabelConfigPair>* configs, Err* err);
124 bool ResolveActionValues(ActionValues* action_values, Err* err);
120 bool ResolveToolchain(Target* target, Err* err); 125 bool ResolveToolchain(Target* target, Err* err);
121 bool ResolvePools(Toolchain* toolchain, Err* err); 126 bool ResolvePools(Toolchain* toolchain, Err* err);
122 127
123 // Given a list of unresolved records, tries to find any circular 128 // Given a list of unresolved records, tries to find any circular
124 // dependencies and returns the string describing the problem. If no circular 129 // dependencies and returns the string describing the problem. If no circular
125 // deps were found, returns the empty string. 130 // deps were found, returns the empty string.
126 std::string CheckForCircularDependencies( 131 std::string CheckForCircularDependencies(
127 const std::vector<const BuilderRecord*>& bad_records) const; 132 const std::vector<const BuilderRecord*>& bad_records) const;
128 133
129 // Non owning pointer. 134 // Non owning pointer.
130 Loader* loader_; 135 Loader* loader_;
131 136
132 // Owning pointers. 137 // Owning pointers.
133 typedef std::map<Label, BuilderRecord*> RecordMap; 138 typedef std::map<Label, BuilderRecord*> RecordMap;
134 RecordMap records_; 139 RecordMap records_;
135 140
136 ResolvedGeneratedCallback resolved_and_generated_callback_; 141 ResolvedGeneratedCallback resolved_and_generated_callback_;
137 142
138 DISALLOW_COPY_AND_ASSIGN(Builder); 143 DISALLOW_COPY_AND_ASSIGN(Builder);
139 }; 144 };
140 145
141 #endif // TOOLS_GN_BUILDER_H_ 146 #endif // TOOLS_GN_BUILDER_H_
OLDNEW
« no previous file with comments | « tools/gn/action_values.cc ('k') | tools/gn/builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698