| 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 13 matching lines...) Expand all Loading... |
| 24 #include "tools/gn/input_file.h" | 24 #include "tools/gn/input_file.h" |
| 25 #include "tools/gn/parse_tree.h" | 25 #include "tools/gn/parse_tree.h" |
| 26 #include "tools/gn/parser.h" | 26 #include "tools/gn/parser.h" |
| 27 #include "tools/gn/source_dir.h" | 27 #include "tools/gn/source_dir.h" |
| 28 #include "tools/gn/source_file.h" | 28 #include "tools/gn/source_file.h" |
| 29 #include "tools/gn/standard_out.h" | 29 #include "tools/gn/standard_out.h" |
| 30 #include "tools/gn/switches.h" | 30 #include "tools/gn/switches.h" |
| 31 #include "tools/gn/tokenizer.h" | 31 #include "tools/gn/tokenizer.h" |
| 32 #include "tools/gn/trace.h" | 32 #include "tools/gn/trace.h" |
| 33 #include "tools/gn/value.h" | 33 #include "tools/gn/value.h" |
| 34 #include "tools/gn/value_extractors.h" |
| 34 | 35 |
| 35 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 36 #include <windows.h> | 37 #include <windows.h> |
| 37 #endif | 38 #endif |
| 38 | 39 |
| 39 extern const char kDotfile_Help[] = | 40 extern const char kDotfile_Help[] = |
| 40 ".gn file\n" | 41 ".gn file\n" |
| 41 "\n" | 42 "\n" |
| 42 " When gn starts, it will search the current directory and parent\n" | 43 " When gn starts, it will search the current directory and parent\n" |
| 43 " directories for a file called \".gn\". This indicates the source root.\n" | 44 " directories for a file called \".gn\". This indicates the source root.\n" |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 err.PrintToStdout(); | 649 err.PrintToStdout(); |
| 649 return false; | 650 return false; |
| 650 } | 651 } |
| 651 build_settings_.set_build_config_file( | 652 build_settings_.set_build_config_file( |
| 652 SourceFile(build_config_value->string_value())); | 653 SourceFile(build_config_value->string_value())); |
| 653 | 654 |
| 654 // Targets to check. | 655 // Targets to check. |
| 655 const Value* check_targets_value = | 656 const Value* check_targets_value = |
| 656 dotfile_scope_.GetValue("check_targets", true); | 657 dotfile_scope_.GetValue("check_targets", true); |
| 657 if (check_targets_value) { | 658 if (check_targets_value) { |
| 658 // Fill the list of targets to check. | 659 check_patterns_.reset(new std::vector<LabelPattern>); |
| 659 if (!check_targets_value->VerifyTypeIs(Value::LIST, &err)) { | 660 ExtractListOfLabelPatterns(*check_targets_value, current_dir, |
| 661 check_patterns_.get(), &err); |
| 662 if (err.has_error()) { |
| 660 err.PrintToStdout(); | 663 err.PrintToStdout(); |
| 661 return false; | 664 return false; |
| 662 } | 665 } |
| 663 | |
| 664 check_patterns_.reset(new std::vector<LabelPattern>); | |
| 665 for (const auto& item : check_targets_value->list_value()) { | |
| 666 check_patterns_->push_back( | |
| 667 LabelPattern::GetPattern(current_dir, item, &err)); | |
| 668 if (err.has_error()) { | |
| 669 err.PrintToStdout(); | |
| 670 return false; | |
| 671 } | |
| 672 } | |
| 673 } | 666 } |
| 674 | 667 |
| 675 // Fill exec_script_whitelist. | 668 // Fill exec_script_whitelist. |
| 676 const Value* exec_script_whitelist_value = | 669 const Value* exec_script_whitelist_value = |
| 677 dotfile_scope_.GetValue("exec_script_whitelist", true); | 670 dotfile_scope_.GetValue("exec_script_whitelist", true); |
| 678 if (exec_script_whitelist_value) { | 671 if (exec_script_whitelist_value) { |
| 679 // Fill the list of targets to check. | 672 // Fill the list of targets to check. |
| 680 if (!exec_script_whitelist_value->VerifyTypeIs(Value::LIST, &err)) { | 673 if (!exec_script_whitelist_value->VerifyTypeIs(Value::LIST, &err)) { |
| 681 err.PrintToStdout(); | 674 err.PrintToStdout(); |
| 682 return false; | 675 return false; |
| 683 } | 676 } |
| 684 scoped_ptr<std::set<SourceFile>> whitelist(new std::set<SourceFile>); | 677 scoped_ptr<std::set<SourceFile>> whitelist(new std::set<SourceFile>); |
| 685 for (const auto& item : exec_script_whitelist_value->list_value()) { | 678 for (const auto& item : exec_script_whitelist_value->list_value()) { |
| 686 if (!item.VerifyTypeIs(Value::STRING, &err)) { | 679 if (!item.VerifyTypeIs(Value::STRING, &err)) { |
| 687 err.PrintToStdout(); | 680 err.PrintToStdout(); |
| 688 return false; | 681 return false; |
| 689 } | 682 } |
| 690 whitelist->insert(current_dir.ResolveRelativeFile(item, &err)); | 683 whitelist->insert(current_dir.ResolveRelativeFile(item, &err)); |
| 691 if (err.has_error()) { | 684 if (err.has_error()) { |
| 692 err.PrintToStdout(); | 685 err.PrintToStdout(); |
| 693 return false; | 686 return false; |
| 694 } | 687 } |
| 695 } | 688 } |
| 696 build_settings_.set_exec_script_whitelist(std::move(whitelist)); | 689 build_settings_.set_exec_script_whitelist(std::move(whitelist)); |
| 697 } | 690 } |
| 698 | 691 |
| 699 return true; | 692 return true; |
| 700 } | 693 } |
| OLD | NEW |