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

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

Issue 2824153002: Use $root:default as a "default" rule (Closed)
Patch Set: Code review feedback Created 3 years, 8 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/ninja_build_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/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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 err.PrintToStdout(); 691 err.PrintToStdout();
692 return false; 692 return false;
693 } 693 }
694 694
695 return true; 695 return true;
696 } 696 }
697 697
698 bool Setup::FillOtherConfig(const base::CommandLine& cmdline) { 698 bool Setup::FillOtherConfig(const base::CommandLine& cmdline) {
699 Err err; 699 Err err;
700 SourceDir current_dir("//"); 700 SourceDir current_dir("//");
701 Label root_target_label(current_dir, "");
701 702
702 // Secondary source path, read from the config file if present. 703 // Secondary source path, read from the config file if present.
703 // Read from the config file if present. 704 // Read from the config file if present.
704 const Value* secondary_value = 705 const Value* secondary_value =
705 dotfile_scope_.GetValue("secondary_source", true); 706 dotfile_scope_.GetValue("secondary_source", true);
706 if (secondary_value) { 707 if (secondary_value) {
707 if (!secondary_value->VerifyTypeIs(Value::STRING, &err)) { 708 if (!secondary_value->VerifyTypeIs(Value::STRING, &err)) {
708 err.PrintToStdout(); 709 err.PrintToStdout();
709 return false; 710 return false;
710 } 711 }
711 build_settings_.SetSecondarySourcePath( 712 build_settings_.SetSecondarySourcePath(
712 SourceDir(secondary_value->string_value())); 713 SourceDir(secondary_value->string_value()));
713 } 714 }
714 715
715 // Root build file. 716 // Root build file.
716 const Value* root_value = dotfile_scope_.GetValue("root", true); 717 const Value* root_value = dotfile_scope_.GetValue("root", true);
717 if (root_value) { 718 if (root_value) {
718 if (!root_value->VerifyTypeIs(Value::STRING, &err)) { 719 if (!root_value->VerifyTypeIs(Value::STRING, &err)) {
719 err.PrintToStdout(); 720 err.PrintToStdout();
720 return false; 721 return false;
721 } 722 }
722 723
723 Label root_target_label = 724 root_target_label = Label::Resolve(current_dir, Label(), *root_value, &err);
724 Label::Resolve(current_dir, Label(), *root_value, &err);
725 if (err.has_error()) { 725 if (err.has_error()) {
726 err.PrintToStdout(); 726 err.PrintToStdout();
727 return false; 727 return false;
728 } 728 }
729 729
730 root_build_file_ = Loader::BuildFileForLabel(root_target_label); 730 root_build_file_ = Loader::BuildFileForLabel(root_target_label);
731 } 731 }
732 build_settings_.SetRootTargetLabel(root_target_label);
732 733
733 // Build config file. 734 // Build config file.
734 const Value* build_config_value = 735 const Value* build_config_value =
735 dotfile_scope_.GetValue("buildconfig", true); 736 dotfile_scope_.GetValue("buildconfig", true);
736 if (!build_config_value) { 737 if (!build_config_value) {
737 Err(Location(), "No build config file.", 738 Err(Location(), "No build config file.",
738 "Your .gn file (\"" + FilePathToUTF8(dotfile_name_) + "\")\n" 739 "Your .gn file (\"" + FilePathToUTF8(dotfile_name_) + "\")\n"
739 "didn't specify a \"buildconfig\" value.").PrintToStdout(); 740 "didn't specify a \"buildconfig\" value.").PrintToStdout();
740 return false; 741 return false;
741 } else if (!build_config_value->VerifyTypeIs(Value::STRING, &err)) { 742 } else if (!build_config_value->VerifyTypeIs(Value::STRING, &err)) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 if (!arg_file_template_value->VerifyTypeIs(Value::STRING, &err)) { 801 if (!arg_file_template_value->VerifyTypeIs(Value::STRING, &err)) {
801 err.PrintToStdout(); 802 err.PrintToStdout();
802 return false; 803 return false;
803 } 804 }
804 SourceFile path(arg_file_template_value->string_value()); 805 SourceFile path(arg_file_template_value->string_value());
805 build_settings_.set_arg_file_template_path(path); 806 build_settings_.set_arg_file_template_path(path);
806 } 807 }
807 808
808 return true; 809 return true;
809 } 810 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_build_writer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698