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

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

Issue 387663003: Improve GN handling of directory templates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/ninja_target_writer.cc ('k') | no next file » | 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/target_generator.h" 5 #include "tools/gn/target_generator.h"
6 6
7 #include "tools/gn/action_target_generator.h" 7 #include "tools/gn/action_target_generator.h"
8 #include "tools/gn/binary_target_generator.h" 8 #include "tools/gn/binary_target_generator.h"
9 #include "tools/gn/build_settings.h" 9 #include "tools/gn/build_settings.h"
10 #include "tools/gn/config.h" 10 #include "tools/gn/config.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 FillForwardDependentConfigs(); 215 FillForwardDependentConfigs();
216 if (err_->has_error()) 216 if (err_->has_error())
217 return; 217 return;
218 } 218 }
219 219
220 void TargetGenerator::FillOutputs() { 220 void TargetGenerator::FillOutputs() {
221 const Value* value = scope_->GetValue(variables::kOutputs, true); 221 const Value* value = scope_->GetValue(variables::kOutputs, true);
222 if (!value) 222 if (!value)
223 return; 223 return;
224 224
225 Target::FileList outputs; 225 std::vector<std::string>& outputs = target_->action_values().outputs();
226 if (!ExtractListOfRelativeFiles(scope_->settings()->build_settings(), *value, 226 if (!ExtractListOfStringValues(*value, &outputs, err_))
227 scope_->GetSourceDir(), &outputs, err_))
228 return; 227 return;
229 228
230 // Validate that outputs are in the output dir. 229 // Validate that outputs are in the output dir.
230 bool allow_templates = target_->output_type() == Target::ACTION_FOREACH ||
231 target_->output_type() == Target::COPY_FILES;
231 CHECK(outputs.size() == value->list_value().size()); 232 CHECK(outputs.size() == value->list_value().size());
232 for (size_t i = 0; i < outputs.size(); i++) { 233 for (size_t i = 0; i < outputs.size(); i++) {
233 if (!EnsureStringIsInOutputDir( 234 if (!EnsureStringIsInOutputDir(
234 GetBuildSettings()->build_dir(), 235 GetBuildSettings()->build_dir(),
235 outputs[i].value(), value->list_value()[i], err_)) 236 outputs[i], value->list_value()[i], allow_templates, err_))
236 return; 237 return;
237 } 238 }
238 target_->action_values().outputs().swap(outputs);
239 } 239 }
240 240
241 void TargetGenerator::FillGenericConfigs(const char* var_name, 241 void TargetGenerator::FillGenericConfigs(const char* var_name,
242 LabelConfigVector* dest) { 242 LabelConfigVector* dest) {
243 const Value* value = scope_->GetValue(var_name, true); 243 const Value* value = scope_->GetValue(var_name, true);
244 if (value) { 244 if (value) {
245 ExtractListOfLabels(*value, scope_->GetSourceDir(), 245 ExtractListOfLabels(*value, scope_->GetSourceDir(),
246 ToolchainLabelForScope(scope_), dest, err_); 246 ToolchainLabelForScope(scope_), dest, err_);
247 } 247 }
248 } 248 }
249 249
250 void TargetGenerator::FillGenericDeps(const char* var_name, 250 void TargetGenerator::FillGenericDeps(const char* var_name,
251 LabelTargetVector* dest) { 251 LabelTargetVector* dest) {
252 const Value* value = scope_->GetValue(var_name, true); 252 const Value* value = scope_->GetValue(var_name, true);
253 if (value) { 253 if (value) {
254 ExtractListOfLabels(*value, scope_->GetSourceDir(), 254 ExtractListOfLabels(*value, scope_->GetSourceDir(),
255 ToolchainLabelForScope(scope_), dest, err_); 255 ToolchainLabelForScope(scope_), dest, err_);
256 } 256 }
257 } 257 }
258 258
259 void TargetGenerator::FillForwardDependentConfigs() { 259 void TargetGenerator::FillForwardDependentConfigs() {
260 const Value* value = scope_->GetValue( 260 const Value* value = scope_->GetValue(
261 variables::kForwardDependentConfigsFrom, true); 261 variables::kForwardDependentConfigsFrom, true);
262 if (value) { 262 if (value) {
263 ExtractListOfLabels(*value, scope_->GetSourceDir(), 263 ExtractListOfLabels(*value, scope_->GetSourceDir(),
264 ToolchainLabelForScope(scope_), 264 ToolchainLabelForScope(scope_),
265 &target_->forward_dependent_configs(), err_); 265 &target_->forward_dependent_configs(), err_);
266 } 266 }
267 } 267 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_target_writer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698