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

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

Issue 2940873002: Implement tracking of BUILD.gn files used to define target, toolchain or (Closed)
Patch Set: Fix compilation after rebase. 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/setup.h ('k') | tools/gn/string_utils_unittest.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 #include "tools/gn/setup.h" 5 #include "tools/gn/setup.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <sstream> 9 #include <sstream>
10 #include <utility> 10 #include <utility>
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 const char Setup::kBuildArgFileName[] = "args.gn"; 275 const char Setup::kBuildArgFileName[] = "args.gn";
276 276
277 Setup::Setup() 277 Setup::Setup()
278 : build_settings_(), 278 : build_settings_(),
279 loader_(new LoaderImpl(&build_settings_)), 279 loader_(new LoaderImpl(&build_settings_)),
280 builder_(loader_.get()), 280 builder_(loader_.get()),
281 root_build_file_("//BUILD.gn"), 281 root_build_file_("//BUILD.gn"),
282 check_public_headers_(false), 282 check_public_headers_(false),
283 dotfile_settings_(&build_settings_, std::string()), 283 dotfile_settings_(&build_settings_, std::string()),
284 dotfile_scope_(&dotfile_settings_), 284 dotfile_scope_(&dotfile_settings_, {}),
285 default_args_(nullptr), 285 default_args_(nullptr),
286 fill_arguments_(true) { 286 fill_arguments_(true) {
287 dotfile_settings_.set_toolchain_label(Label()); 287 dotfile_settings_.set_toolchain_label(Label());
288 288
289 build_settings_.set_item_defined_callback( 289 build_settings_.set_item_defined_callback(
290 base::Bind(&ItemDefinedCallback, scheduler_.task_runner(), &builder_)); 290 base::Bind(&ItemDefinedCallback, scheduler_.task_runner(), &builder_));
291 291
292 loader_->set_complete_callback(base::Bind(&DecrementWorkCount)); 292 loader_->set_complete_callback(base::Bind(&DecrementWorkCount));
293 // The scheduler's task runner wasn't created when the Loader was created, so 293 // The scheduler's task runner wasn't created when the Loader was created, so
294 // we need to set it now. 294 // we need to set it now.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 err.PrintToStdout(); 464 err.PrintToStdout();
465 return false; 465 return false;
466 } 466 }
467 467
468 args_root_ = Parser::Parse(args_tokens_, &err); 468 args_root_ = Parser::Parse(args_tokens_, &err);
469 if (err.has_error()) { 469 if (err.has_error()) {
470 err.PrintToStdout(); 470 err.PrintToStdout();
471 return false; 471 return false;
472 } 472 }
473 473
474 Scope arg_scope(&dotfile_settings_); 474 Scope arg_scope(&dotfile_settings_, {args_input_file_.get()});
475 // Set soure dir so relative imports in args work. 475 // Set soure dir so relative imports in args work.
476 SourceDir root_source_dir = 476 SourceDir root_source_dir =
477 SourceDirForCurrentDirectory(build_settings_.root_path()); 477 SourceDirForCurrentDirectory(build_settings_.root_path());
478 arg_scope.set_source_dir(root_source_dir); 478 arg_scope.set_source_dir(root_source_dir);
479 args_root_->Execute(&arg_scope, &err); 479 args_root_->Execute(&arg_scope, &err);
480 if (err.has_error()) { 480 if (err.has_error()) {
481 err.PrintToStdout(); 481 err.PrintToStdout();
482 return false; 482 return false;
483 } 483 }
484 484
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 #endif 661 #endif
662 } 662 }
663 return true; 663 return true;
664 } 664 }
665 665
666 bool Setup::RunConfigFile() { 666 bool Setup::RunConfigFile() {
667 if (scheduler_.verbose_logging()) 667 if (scheduler_.verbose_logging())
668 scheduler_.Log("Got dotfile", FilePathToUTF8(dotfile_name_)); 668 scheduler_.Log("Got dotfile", FilePathToUTF8(dotfile_name_));
669 669
670 dotfile_input_file_.reset(new InputFile(SourceFile("//.gn"))); 670 dotfile_input_file_.reset(new InputFile(SourceFile("//.gn")));
671 dotfile_scope_.AddInputFile(dotfile_input_file_.get());
671 if (!dotfile_input_file_->Load(dotfile_name_)) { 672 if (!dotfile_input_file_->Load(dotfile_name_)) {
672 Err(Location(), "Could not load dotfile.", 673 Err(Location(), "Could not load dotfile.",
673 "The file \"" + FilePathToUTF8(dotfile_name_) + "\" couldn't be loaded") 674 "The file \"" + FilePathToUTF8(dotfile_name_) + "\" couldn't be loaded")
674 .PrintToStdout(); 675 .PrintToStdout();
675 return false; 676 return false;
676 } 677 }
677 678
678 Err err; 679 Err err;
679 dotfile_tokens_ = Tokenizer::Tokenize(dotfile_input_file_.get(), &err); 680 dotfile_tokens_ = Tokenizer::Tokenize(dotfile_input_file_.get(), &err);
680 if (err.has_error()) { 681 if (err.has_error()) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 if (!arg_file_template_value->VerifyTypeIs(Value::STRING, &err)) { 804 if (!arg_file_template_value->VerifyTypeIs(Value::STRING, &err)) {
804 err.PrintToStdout(); 805 err.PrintToStdout();
805 return false; 806 return false;
806 } 807 }
807 SourceFile path(arg_file_template_value->string_value()); 808 SourceFile path(arg_file_template_value->string_value());
808 build_settings_.set_arg_file_template_path(path); 809 build_settings_.set_arg_file_template_path(path);
809 } 810 }
810 811
811 return true; 812 return true;
812 } 813 }
OLDNEW
« no previous file with comments | « tools/gn/setup.h ('k') | tools/gn/string_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698