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

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

Issue 2152413002: GN: don't write separate files for non-binary targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 years, 4 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/visual_studio_writer.h ('k') | tools/gn/xcode_writer.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/visual_studio_writer.h" 5 #include "tools/gn/visual_studio_writer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 base::StringPiece FindParentDir(const std::string* path) { 159 base::StringPiece FindParentDir(const std::string* path) {
160 DCHECK(path && !path->empty()); 160 DCHECK(path && !path->empty());
161 for (int i = static_cast<int>(path->size()) - 2; i >= 0; --i) { 161 for (int i = static_cast<int>(path->size()) - 2; i >= 0; --i) {
162 if (IsSlash((*path)[i])) 162 if (IsSlash((*path)[i]))
163 return base::StringPiece(path->data(), i); 163 return base::StringPiece(path->data(), i);
164 } 164 }
165 return base::StringPiece(); 165 return base::StringPiece();
166 } 166 }
167 167
168 bool FilterTargets(const BuildSettings* build_settings, 168 bool FilterTargets(const BuildSettings* build_settings,
169 Builder* builder, 169 const Builder& builder,
170 const std::string& dir_filters, 170 const std::string& dir_filters,
171 std::vector<const Target*>* targets, 171 std::vector<const Target*>* targets,
172 Err* err) { 172 Err* err) {
173 if (dir_filters.empty()) { 173 if (dir_filters.empty()) {
174 *targets = builder->GetAllResolvedTargets(); 174 *targets = builder.GetAllResolvedTargets();
175 return true; 175 return true;
176 } 176 }
177 177
178 std::vector<LabelPattern> filters; 178 std::vector<LabelPattern> filters;
179 if (!commands::FilterPatternsFromString(build_settings, dir_filters, &filters, 179 if (!commands::FilterPatternsFromString(build_settings, dir_filters, &filters,
180 err)) 180 err))
181 return false; 181 return false;
182 182
183 commands::FilterTargetsByPatterns(builder->GetAllResolvedTargets(), filters, 183 commands::FilterTargetsByPatterns(builder.GetAllResolvedTargets(), filters,
184 targets); 184 targets);
185 185
186 std::set<Label> labels; 186 std::set<Label> labels;
187 std::queue<const Target*> to_process; 187 std::queue<const Target*> to_process;
188 for (const Target* target : *targets) { 188 for (const Target* target : *targets) {
189 labels.insert(target->label()); 189 labels.insert(target->label());
190 to_process.push(target); 190 to_process.push(target);
191 } 191 }
192 192
193 while (!to_process.empty()) { 193 while (!to_process.empty()) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 263
264 windows_kits_include_dirs_ = GetWindowsKitsIncludeDirs(); 264 windows_kits_include_dirs_ = GetWindowsKitsIncludeDirs();
265 } 265 }
266 266
267 VisualStudioWriter::~VisualStudioWriter() { 267 VisualStudioWriter::~VisualStudioWriter() {
268 } 268 }
269 269
270 // static 270 // static
271 bool VisualStudioWriter::RunAndWriteFiles(const BuildSettings* build_settings, 271 bool VisualStudioWriter::RunAndWriteFiles(const BuildSettings* build_settings,
272 Builder* builder, 272 const Builder& builder,
273 Version version, 273 Version version,
274 const std::string& sln_name, 274 const std::string& sln_name,
275 const std::string& dir_filters, 275 const std::string& dir_filters,
276 Err* err) { 276 Err* err) {
277 std::vector<const Target*> targets; 277 std::vector<const Target*> targets;
278 if (!FilterTargets(build_settings, builder, dir_filters, &targets, err)) 278 if (!FilterTargets(build_settings, builder, dir_filters, &targets, err))
279 return false; 279 return false;
280 280
281 const char* config_platform = "Win32"; 281 const char* config_platform = "Win32";
282 282
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 } 832 }
833 } 833 }
834 834
835 std::string VisualStudioWriter::GetNinjaTarget(const Target* target) { 835 std::string VisualStudioWriter::GetNinjaTarget(const Target* target) {
836 std::ostringstream ninja_target_out; 836 std::ostringstream ninja_target_out;
837 DCHECK(!target->dependency_output_file().value().empty()); 837 DCHECK(!target->dependency_output_file().value().empty());
838 ninja_path_output_.WriteFile(ninja_target_out, 838 ninja_path_output_.WriteFile(ninja_target_out,
839 target->dependency_output_file()); 839 target->dependency_output_file());
840 return ninja_target_out.str(); 840 return ninja_target_out.str();
841 } 841 }
OLDNEW
« no previous file with comments | « tools/gn/visual_studio_writer.h ('k') | tools/gn/xcode_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698