| OLD | NEW |
| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 // path. | 507 // path. |
| 508 base::FilePath dot_file_path = | 508 base::FilePath dot_file_path = |
| 509 cmdline.GetSwitchValuePath(switches::kDotfile); | 509 cmdline.GetSwitchValuePath(switches::kDotfile); |
| 510 if (dot_file_path.empty()) { | 510 if (dot_file_path.empty()) { |
| 511 dotfile_name_ = root_path.Append(kGnFile); | 511 dotfile_name_ = root_path.Append(kGnFile); |
| 512 } else { | 512 } else { |
| 513 dotfile_name_ = base::MakeAbsoluteFilePath(dot_file_path); | 513 dotfile_name_ = base::MakeAbsoluteFilePath(dot_file_path); |
| 514 if (dotfile_name_.empty()) { | 514 if (dotfile_name_.empty()) { |
| 515 Err(Location(), "Could not load dotfile.", | 515 Err(Location(), "Could not load dotfile.", |
| 516 "The file \"" + FilePathToUTF8(dot_file_path) + | 516 "The file \"" + FilePathToUTF8(dot_file_path) + |
| 517 "\" cound't be loaded.").PrintToStdout(); | 517 "\" couldn't be loaded.").PrintToStdout(); |
| 518 return false; | 518 return false; |
| 519 } | 519 } |
| 520 } | 520 } |
| 521 } else { | 521 } else { |
| 522 // In the default case, look for a dotfile and that also tells us where the | 522 // In the default case, look for a dotfile and that also tells us where the |
| 523 // source root is. | 523 // source root is. |
| 524 base::FilePath cur_dir; | 524 base::FilePath cur_dir; |
| 525 base::GetCurrentDirectory(&cur_dir); | 525 base::GetCurrentDirectory(&cur_dir); |
| 526 dotfile_name_ = FindDotFile(cur_dir); | 526 dotfile_name_ = FindDotFile(cur_dir); |
| 527 if (dotfile_name_.empty()) { | 527 if (dotfile_name_.empty()) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 617 } |
| 618 } | 618 } |
| 619 | 619 |
| 620 bool Setup::RunConfigFile() { | 620 bool Setup::RunConfigFile() { |
| 621 if (scheduler_.verbose_logging()) | 621 if (scheduler_.verbose_logging()) |
| 622 scheduler_.Log("Got dotfile", FilePathToUTF8(dotfile_name_)); | 622 scheduler_.Log("Got dotfile", FilePathToUTF8(dotfile_name_)); |
| 623 | 623 |
| 624 dotfile_input_file_.reset(new InputFile(SourceFile("//.gn"))); | 624 dotfile_input_file_.reset(new InputFile(SourceFile("//.gn"))); |
| 625 if (!dotfile_input_file_->Load(dotfile_name_)) { | 625 if (!dotfile_input_file_->Load(dotfile_name_)) { |
| 626 Err(Location(), "Could not load dotfile.", | 626 Err(Location(), "Could not load dotfile.", |
| 627 "The file \"" + FilePathToUTF8(dotfile_name_) + "\" cound't be loaded") | 627 "The file \"" + FilePathToUTF8(dotfile_name_) + "\" couldn't be loaded") |
| 628 .PrintToStdout(); | 628 .PrintToStdout(); |
| 629 return false; | 629 return false; |
| 630 } | 630 } |
| 631 | 631 |
| 632 Err err; | 632 Err err; |
| 633 dotfile_tokens_ = Tokenizer::Tokenize(dotfile_input_file_.get(), &err); | 633 dotfile_tokens_ = Tokenizer::Tokenize(dotfile_input_file_.get(), &err); |
| 634 if (err.has_error()) { | 634 if (err.has_error()) { |
| 635 err.PrintToStdout(); | 635 err.PrintToStdout(); |
| 636 return false; | 636 return false; |
| 637 } | 637 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 if (err.has_error()) { | 733 if (err.has_error()) { |
| 734 err.PrintToStdout(); | 734 err.PrintToStdout(); |
| 735 return false; | 735 return false; |
| 736 } | 736 } |
| 737 } | 737 } |
| 738 build_settings_.set_exec_script_whitelist(std::move(whitelist)); | 738 build_settings_.set_exec_script_whitelist(std::move(whitelist)); |
| 739 } | 739 } |
| 740 | 740 |
| 741 return true; | 741 return true; |
| 742 } | 742 } |
| OLD | NEW |