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

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

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

Powered by Google App Engine
This is Rietveld 408576698