| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "tools/gn/commands.h" | 9 #include "tools/gn/commands.h" |
| 10 #include "tools/gn/label_pattern.h" | 10 #include "tools/gn/label_pattern.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 " in multiple toolchains).\n"; | 69 " in multiple toolchains).\n"; |
| 70 | 70 |
| 71 int RunLs(const std::vector<std::string>& args) { | 71 int RunLs(const std::vector<std::string>& args) { |
| 72 if (args.size() == 0) { | 72 if (args.size() == 0) { |
| 73 Err(Location(), "You're holding it wrong.", | 73 Err(Location(), "You're holding it wrong.", |
| 74 "Usage: \"gn ls <build dir> [<label_pattern>]*\"").PrintToStdout(); | 74 "Usage: \"gn ls <build dir> [<label_pattern>]*\"").PrintToStdout(); |
| 75 return 1; | 75 return 1; |
| 76 } | 76 } |
| 77 | 77 |
| 78 Setup* setup = new Setup; | 78 Setup* setup = new Setup; |
| 79 setup->build_settings().set_check_for_bad_items(false); |
| 79 if (!setup->DoSetup(args[0], false) || !setup->Run()) | 80 if (!setup->DoSetup(args[0], false) || !setup->Run()) |
| 80 return 1; | 81 return 1; |
| 81 | 82 |
| 82 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); | 83 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
| 83 bool all_toolchains = cmdline->HasSwitch("all-toolchains"); | 84 bool all_toolchains = cmdline->HasSwitch("all-toolchains"); |
| 84 | 85 |
| 85 std::vector<const Target*> matches; | 86 std::vector<const Target*> matches; |
| 86 if (args.size() > 1) { | 87 if (args.size() > 1) { |
| 87 // Some patterns or explicit labels were specified. | 88 // Some patterns or explicit labels were specified. |
| 88 std::vector<std::string> inputs(args.begin() + 1, args.end()); | 89 std::vector<std::string> inputs(args.begin() + 1, args.end()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 105 for (const auto& target : setup->builder()->GetAllResolvedTargets()) { | 106 for (const auto& target : setup->builder()->GetAllResolvedTargets()) { |
| 106 if (target->settings()->is_default()) | 107 if (target->settings()->is_default()) |
| 107 matches.push_back(target); | 108 matches.push_back(target); |
| 108 } | 109 } |
| 109 } | 110 } |
| 110 FilterAndPrintTargets(false, &matches); | 111 FilterAndPrintTargets(false, &matches); |
| 111 return 0; | 112 return 0; |
| 112 } | 113 } |
| 113 | 114 |
| 114 } // namespace commands | 115 } // namespace commands |
| OLD | NEW |