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

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

Issue 2627703002: Validate GN substitutions in args and rsp files. (Closed)
Patch Set: Format Created 3 years, 11 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/substitution_type.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "tools/gn/action_target_generator.h" 9 #include "tools/gn/action_target_generator.h"
10 #include "tools/gn/binary_target_generator.h" 10 #include "tools/gn/binary_target_generator.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 if (!outputs.required_types().empty()) { 305 if (!outputs.required_types().empty()) {
306 *err_ = Err(*value, "Source expansions not allowed here.", 306 *err_ = Err(*value, "Source expansions not allowed here.",
307 "The outputs of this target used source {{expansions}} but this " 307 "The outputs of this target used source {{expansions}} but this "
308 "target type\ndoesn't support them. Just express the outputs " 308 "target type\ndoesn't support them. Just express the outputs "
309 "literally."); 309 "literally.");
310 return false; 310 return false;
311 } 311 }
312 } 312 }
313 313
314 // Check the substitutions used are valid for this purpose. 314 // Check the substitutions used are valid for this purpose.
315 if (!EnsureValidSourcesSubstitutions(outputs.required_types(), 315 if (!EnsureValidSubstitutions(outputs.required_types(),
316 value->origin(), err_)) 316 &IsValidSourceSubstitution,
317 value->origin(), err_))
317 return false; 318 return false;
318 319
319 // Validate that outputs are in the output dir. 320 // Validate that outputs are in the output dir.
320 CHECK(outputs.list().size() == value->list_value().size()); 321 CHECK(outputs.list().size() == value->list_value().size());
321 for (size_t i = 0; i < outputs.list().size(); i++) { 322 for (size_t i = 0; i < outputs.list().size(); i++) {
322 if (!EnsureSubstitutionIsInOutputDir(outputs.list()[i], 323 if (!EnsureSubstitutionIsInOutputDir(outputs.list()[i],
323 value->list_value()[i])) 324 value->list_value()[i]))
324 return false; 325 return false;
325 } 326 }
326 return true; 327 return true;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if (err_->has_error()) 399 if (err_->has_error())
399 return false; 400 return false;
400 if (!EnsureStringIsInOutputDir(GetBuildSettings()->build_dir(), 401 if (!EnsureStringIsInOutputDir(GetBuildSettings()->build_dir(),
401 source_file.value(), value->origin(), err_)) 402 source_file.value(), value->origin(), err_))
402 return false; 403 return false;
403 OutputFile output_file(GetBuildSettings(), source_file); 404 OutputFile output_file(GetBuildSettings(), source_file);
404 target_->set_write_runtime_deps_output(output_file); 405 target_->set_write_runtime_deps_output(output_file);
405 406
406 return true; 407 return true;
407 } 408 }
OLDNEW
« no previous file with comments | « tools/gn/substitution_type.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698