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

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

Issue 165823003: GN: Change gen command syntax, support relative dirs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change in build file writing Created 6 years, 10 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 | Annotate | Revision Log
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 <set> 5 #include <set>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "tools/gn/commands.h" 8 #include "tools/gn/commands.h"
9 #include "tools/gn/filesystem_utils.h" 9 #include "tools/gn/filesystem_utils.h"
10 #include "tools/gn/input_file.h" 10 #include "tools/gn/input_file.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 "or it can never match anything.\nTo match a substring, use " 78 "or it can never match anything.\nTo match a substring, use "
79 "\"*foo*\".").PrintToStdout(); 79 "\"*foo*\".").PrintToStdout();
80 return 1; 80 return 1;
81 } 81 }
82 } 82 }
83 83
84 Pattern pattern(args[0]); 84 Pattern pattern(args[0]);
85 85
86 Setup* setup = new Setup; 86 Setup* setup = new Setup;
87 setup->set_check_for_bad_items(false); 87 setup->set_check_for_bad_items(false);
88 if (!setup->DoSetup() || !setup->Run()) 88 // TODO(brettw) bug 343726: Use a temporary directory instead of this
89 // default one to avoid messing up any build that's in there.
90 if (!setup->DoSetup("//out/Default/") || !setup->Run())
89 return 1; 91 return 1;
90 92
91 std::vector<const BuilderRecord*> records = setup->builder()->GetAllRecords(); 93 std::vector<const BuilderRecord*> records = setup->builder()->GetAllRecords();
92 94
93 const CommandLine* cmdline = CommandLine::ForCurrentProcess(); 95 const CommandLine* cmdline = CommandLine::ForCurrentProcess();
94 96
95 bool file_output = cmdline->HasSwitch("files"); 97 bool file_output = cmdline->HasSwitch("files");
96 std::set<std::string> unique_output; 98 std::set<std::string> unique_output;
97 99
98 for (size_t record_index = 0; record_index < records.size(); record_index++) { 100 for (size_t record_index = 0; record_index < records.size(); record_index++) {
(...skipping 19 matching lines...) Expand all
118 } 120 }
119 121
120 for (std::set<std::string>::iterator i = unique_output.begin(); 122 for (std::set<std::string>::iterator i = unique_output.begin();
121 i != unique_output.end(); ++i) 123 i != unique_output.end(); ++i)
122 OutputString(*i + "\n"); 124 OutputString(*i + "\n");
123 125
124 return 0; 126 return 0;
125 } 127 }
126 128
127 } // namespace commands 129 } // namespace commands
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698