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

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

Issue 48523006: GN: Separately track labels and origins for lists of stuff (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « tools/gn/label_ptr.h ('k') | tools/gn/ninja_binary_target_writer_unittest.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 (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 "tools/gn/ninja_binary_target_writer.h" 5 #include "tools/gn/ninja_binary_target_writer.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "tools/gn/config_values_extractors.h" 10 #include "tools/gn/config_values_extractors.h"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // Append data dependencies as implicit dependencies. 367 // Append data dependencies as implicit dependencies.
368 WriteImplicitDependencies(non_linkable_deps); 368 WriteImplicitDependencies(non_linkable_deps);
369 369
370 out_ << std::endl; 370 out_ << std::endl;
371 } 371 }
372 372
373 void NinjaBinaryTargetWriter::GetDeps( 373 void NinjaBinaryTargetWriter::GetDeps(
374 std::set<OutputFile>* extra_object_files, 374 std::set<OutputFile>* extra_object_files,
375 std::vector<const Target*>* linkable_deps, 375 std::vector<const Target*>* linkable_deps,
376 std::vector<const Target*>* non_linkable_deps) const { 376 std::vector<const Target*>* non_linkable_deps) const {
377 const std::vector<const Target*>& deps = target_->deps(); 377 const LabelTargetVector& deps = target_->deps();
378 const std::set<const Target*>& inherited = target_->inherited_libraries(); 378 const std::set<const Target*>& inherited = target_->inherited_libraries();
379 379
380 // Normal deps. 380 // Normal deps.
381 for (size_t i = 0; i < deps.size(); i++) { 381 for (size_t i = 0; i < deps.size(); i++) {
382 if (inherited.find(deps[i]) != inherited.end()) 382 if (inherited.find(deps[i].ptr) != inherited.end())
383 continue; // Don't add dupes. 383 continue; // Don't add dupes.
384 ClassifyDependency(deps[i], extra_object_files, 384 ClassifyDependency(deps[i].ptr, extra_object_files,
385 linkable_deps, non_linkable_deps); 385 linkable_deps, non_linkable_deps);
386 } 386 }
387 387
388 // Inherited libraries. 388 // Inherited libraries.
389 for (std::set<const Target*>::const_iterator i = inherited.begin(); 389 for (std::set<const Target*>::const_iterator i = inherited.begin();
390 i != inherited.end(); ++i) { 390 i != inherited.end(); ++i) {
391 ClassifyDependency(*i, extra_object_files, 391 ClassifyDependency(*i, extra_object_files,
392 linkable_deps, non_linkable_deps); 392 linkable_deps, non_linkable_deps);
393 } 393 }
394 394
395 // Data deps. 395 // Data deps.
396 const std::vector<const Target*>& datadeps = target_->datadeps(); 396 const LabelTargetVector& datadeps = target_->datadeps();
397 for (size_t i = 0; i < datadeps.size(); i++) 397 for (size_t i = 0; i < datadeps.size(); i++)
398 non_linkable_deps->push_back(datadeps[i]); 398 non_linkable_deps->push_back(datadeps[i].ptr);
399 } 399 }
400 400
401 void NinjaBinaryTargetWriter::ClassifyDependency( 401 void NinjaBinaryTargetWriter::ClassifyDependency(
402 const Target* dep, 402 const Target* dep,
403 std::set<OutputFile>* extra_object_files, 403 std::set<OutputFile>* extra_object_files,
404 std::vector<const Target*>* linkable_deps, 404 std::vector<const Target*>* linkable_deps,
405 std::vector<const Target*>* non_linkable_deps) const { 405 std::vector<const Target*>* non_linkable_deps) const {
406 // Only these types of outputs have libraries linked into them. Child deps of 406 // Only these types of outputs have libraries linked into them. Child deps of
407 // static libraries get pushed up the dependency tree until one of these is 407 // static libraries get pushed up the dependency tree until one of these is
408 // reached, and source sets don't link at all. 408 // reached, and source sets don't link at all.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 452 }
453 453
454 // Data files. 454 // Data files.
455 const std::vector<SourceFile>& data = target_->data(); 455 const std::vector<SourceFile>& data = target_->data();
456 for (size_t i = 0; i < data.size(); i++) { 456 for (size_t i = 0; i < data.size(); i++) {
457 out_ << " "; 457 out_ << " ";
458 path_output_.WriteFile(out_, data[i]); 458 path_output_.WriteFile(out_, data[i]);
459 } 459 }
460 } 460 }
461 } 461 }
OLDNEW
« no previous file with comments | « tools/gn/label_ptr.h ('k') | tools/gn/ninja_binary_target_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698