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

Side by Side Diff: tools/gn/action_target_generator.cc

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_target_generator.h ('k') | tools/gn/action_values.h » ('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 #include "tools/gn/action_target_generator.h" 5 #include "tools/gn/action_target_generator.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "tools/gn/build_settings.h" 8 #include "tools/gn/build_settings.h"
9 #include "tools/gn/err.h" 9 #include "tools/gn/err.h"
10 #include "tools/gn/filesystem_utils.h" 10 #include "tools/gn/filesystem_utils.h"
11 #include "tools/gn/functions.h"
11 #include "tools/gn/parse_tree.h" 12 #include "tools/gn/parse_tree.h"
12 #include "tools/gn/scope.h" 13 #include "tools/gn/scope.h"
13 #include "tools/gn/value.h" 14 #include "tools/gn/value.h"
14 #include "tools/gn/value_extractors.h" 15 #include "tools/gn/value_extractors.h"
15 #include "tools/gn/variables.h" 16 #include "tools/gn/variables.h"
16 17
17 ActionTargetGenerator::ActionTargetGenerator( 18 ActionTargetGenerator::ActionTargetGenerator(
18 Target* target, 19 Target* target,
19 Scope* scope, 20 Scope* scope,
20 const FunctionCallNode* function_call, 21 const FunctionCallNode* function_call,
(...skipping 30 matching lines...) Expand all
51 52
52 if (!FillResponseFileContents()) 53 if (!FillResponseFileContents())
53 return; 54 return;
54 55
55 if (!FillOutputs(output_type_ == Target::ACTION_FOREACH)) 56 if (!FillOutputs(output_type_ == Target::ACTION_FOREACH))
56 return; 57 return;
57 58
58 if (!FillDepfile()) 59 if (!FillDepfile())
59 return; 60 return;
60 61
61 if (!FillConsole()) 62 if (!FillPool())
62 return; 63 return;
63 64
64 if (!FillCheckIncludes()) 65 if (!FillCheckIncludes())
65 return; 66 return;
66 67
67 if (!CheckOutputs()) 68 if (!CheckOutputs())
68 return; 69 return;
69 70
70 // Action outputs don't depend on the current toolchain so we can skip adding 71 // Action outputs don't depend on the current toolchain so we can skip adding
71 // that dependency. 72 // that dependency.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 SubstitutionPattern depfile; 153 SubstitutionPattern depfile;
153 if (!depfile.Parse(*value, err_)) 154 if (!depfile.Parse(*value, err_))
154 return false; 155 return false;
155 if (!EnsureSubstitutionIsInOutputDir(depfile, *value)) 156 if (!EnsureSubstitutionIsInOutputDir(depfile, *value))
156 return false; 157 return false;
157 158
158 target_->action_values().set_depfile(depfile); 159 target_->action_values().set_depfile(depfile);
159 return true; 160 return true;
160 } 161 }
161 162
162 bool ActionTargetGenerator::FillConsole() { 163 bool ActionTargetGenerator::FillPool() {
163 const Value* value = scope_->GetValue(variables::kConsole, true); 164 const Value* value = scope_->GetValue(variables::kPool, true);
164 if (!value) 165 if (!value)
165 return true; 166 return true;
166 if (!value->VerifyTypeIs(Value::BOOLEAN, err_)) 167
168 Label label = Label::Resolve(scope_->GetSourceDir(),
169 ToolchainLabelForScope(scope_), *value, err_);
170 if (err_->has_error())
167 return false; 171 return false;
168 target_->action_values().set_console(value->boolean_value()); 172
173 LabelPtrPair<Pool> pair(label);
174 pair.origin = target_->defined_from();
175
176 target_->action_values().set_pool(std::move(pair));
169 return true; 177 return true;
170 } 178 }
171 179
172 bool ActionTargetGenerator::CheckOutputs() { 180 bool ActionTargetGenerator::CheckOutputs() {
173 const SubstitutionList& outputs = target_->action_values().outputs(); 181 const SubstitutionList& outputs = target_->action_values().outputs();
174 if (outputs.list().empty()) { 182 if (outputs.list().empty()) {
175 *err_ = Err(function_call_, "Action has no outputs.", 183 *err_ = Err(function_call_, "Action has no outputs.",
176 "If you have no outputs, the build system can not tell when your\n" 184 "If you have no outputs, the build system can not tell when your\n"
177 "script needs to be run."); 185 "script needs to be run.");
178 return false; 186 return false;
(...skipping 13 matching lines...) Expand all
192 *err_ = Err(function_call_, 200 *err_ = Err(function_call_,
193 "action_foreach should have a pattern in the output.", 201 "action_foreach should have a pattern in the output.",
194 "An action_foreach target should have a source expansion pattern in\n" 202 "An action_foreach target should have a source expansion pattern in\n"
195 "it to map source file to unique output file name. Otherwise, the\n" 203 "it to map source file to unique output file name. Otherwise, the\n"
196 "build system can't determine when your script needs to be run."); 204 "build system can't determine when your script needs to be run.");
197 return false; 205 return false;
198 } 206 }
199 } 207 }
200 return true; 208 return true;
201 } 209 }
OLDNEW
« no previous file with comments | « tools/gn/action_target_generator.h ('k') | tools/gn/action_values.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698