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

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

Issue 558763002: Require build directories exist for some GN commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: file path literal Created 6 years, 3 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/command_gen.cc ('k') | tools/gn/command_refs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 " in multiple toolchains).\n"; 60 " in multiple toolchains).\n";
61 61
62 int RunLs(const std::vector<std::string>& args) { 62 int RunLs(const std::vector<std::string>& args) {
63 if (args.size() != 1 && args.size() != 2) { 63 if (args.size() != 1 && args.size() != 2) {
64 Err(Location(), "You're holding it wrong.", 64 Err(Location(), "You're holding it wrong.",
65 "Usage: \"gn ls <build dir> [<label_pattern>]\"").PrintToStdout(); 65 "Usage: \"gn ls <build dir> [<label_pattern>]\"").PrintToStdout();
66 return 1; 66 return 1;
67 } 67 }
68 68
69 Setup* setup = new Setup; 69 Setup* setup = new Setup;
70 if (!setup->DoSetup(args[0]) || !setup->Run()) 70 if (!setup->DoSetup(args[0], false) || !setup->Run())
71 return 1; 71 return 1;
72 72
73 const CommandLine* cmdline = CommandLine::ForCurrentProcess(); 73 const CommandLine* cmdline = CommandLine::ForCurrentProcess();
74 bool all_toolchains = cmdline->HasSwitch("all-toolchains"); 74 bool all_toolchains = cmdline->HasSwitch("all-toolchains");
75 75
76 // Find matching targets. 76 // Find matching targets.
77 std::vector<const Target*> matches; 77 std::vector<const Target*> matches;
78 if (args.size() == 2) { 78 if (args.size() == 2) {
79 // Given a pattern, match it. 79 // Given a pattern, match it.
80 if (!ResolveTargetsFromCommandLinePattern(setup, args[1], all_toolchains, 80 if (!ResolveTargetsFromCommandLinePattern(setup, args[1], all_toolchains,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 OutputString(sorted_matches[i].GetUserVisibleName( 112 OutputString(sorted_matches[i].GetUserVisibleName(
113 sorted_matches[i].GetToolchainLabel() != default_tc_label)); 113 sorted_matches[i].GetToolchainLabel() != default_tc_label));
114 OutputString("\n"); 114 OutputString("\n");
115 } 115 }
116 } 116 }
117 117
118 return 0; 118 return 0;
119 } 119 }
120 120
121 } // namespace commands 121 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/command_gen.cc ('k') | tools/gn/command_refs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698