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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 )"; | 67 )"; |
68 | 68 |
69 int RunLs(const std::vector<std::string>& args) { | 69 int RunLs(const std::vector<std::string>& args) { |
70 if (args.size() == 0) { | 70 if (args.size() == 0) { |
71 Err(Location(), "You're holding it wrong.", | 71 Err(Location(), "You're holding it wrong.", |
72 "Usage: \"gn ls <build dir> [<label_pattern>]*\"").PrintToStdout(); | 72 "Usage: \"gn ls <build dir> [<label_pattern>]*\"").PrintToStdout(); |
73 return 1; | 73 return 1; |
74 } | 74 } |
75 | 75 |
76 Setup* setup = new Setup; | 76 Setup* setup = new Setup; |
77 setup->build_settings().set_check_for_bad_items(false); | |
78 if (!setup->DoSetup(args[0], false) || !setup->Run()) | 77 if (!setup->DoSetup(args[0], false) || !setup->Run()) |
79 return 1; | 78 return 1; |
80 | 79 |
81 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); | 80 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
82 bool all_toolchains = cmdline->HasSwitch(switches::kAllToolchains); | 81 bool all_toolchains = cmdline->HasSwitch(switches::kAllToolchains); |
83 | 82 |
84 std::vector<const Target*> matches; | 83 std::vector<const Target*> matches; |
85 if (args.size() > 1) { | 84 if (args.size() > 1) { |
86 // Some patterns or explicit labels were specified. | 85 // Some patterns or explicit labels were specified. |
87 std::vector<std::string> inputs(args.begin() + 1, args.end()); | 86 std::vector<std::string> inputs(args.begin() + 1, args.end()); |
(...skipping 16 matching lines...) Expand all Loading... |
104 for (auto* target : setup->builder().GetAllResolvedTargets()) { | 103 for (auto* target : setup->builder().GetAllResolvedTargets()) { |
105 if (target->settings()->is_default()) | 104 if (target->settings()->is_default()) |
106 matches.push_back(target); | 105 matches.push_back(target); |
107 } | 106 } |
108 } | 107 } |
109 FilterAndPrintTargets(false, &matches); | 108 FilterAndPrintTargets(false, &matches); |
110 return 0; | 109 return 0; |
111 } | 110 } |
112 | 111 |
113 } // namespace commands | 112 } // namespace commands |
OLD | NEW |