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

Side by Side Diff: tools/gn/ninja_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/ninja_group_target_writer.cc ('k') | tools/gn/target.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 (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_target_writer.h" 5 #include "tools/gn/ninja_target_writer.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 // Input files are order-only deps. 96 // Input files are order-only deps.
97 const Target::FileList& prereqs = target_->source_prereqs(); 97 const Target::FileList& prereqs = target_->source_prereqs();
98 bool has_files = !prereqs.empty(); 98 bool has_files = !prereqs.empty();
99 for (size_t i = 0; i < prereqs.size(); i++) { 99 for (size_t i = 0; i < prereqs.size(); i++) {
100 ret << " "; 100 ret << " ";
101 path_output_.WriteFile(ret, prereqs[i]); 101 path_output_.WriteFile(ret, prereqs[i]);
102 } 102 }
103 103
104 // Add on any direct deps marked as "hard". 104 // Add on any direct deps marked as "hard".
105 const std::vector<const Target*>& deps = target_->deps(); 105 const LabelTargetVector& deps = target_->deps();
106 for (size_t i = 0; i < deps.size(); i++) { 106 for (size_t i = 0; i < deps.size(); i++) {
107 if (deps[i]->hard_dep()) { 107 if (deps[i].ptr->hard_dep()) {
108 has_files = true; 108 has_files = true;
109 ret << " "; 109 ret << " ";
110 path_output_.WriteFile(ret, helper_.GetTargetOutputFile(deps[i])); 110 path_output_.WriteFile(ret, helper_.GetTargetOutputFile(deps[i].ptr));
111 } 111 }
112 } 112 }
113 113
114 if (has_files) 114 if (has_files)
115 return ret.str(); 115 return ret.str();
116 return std::string(); // No files added. 116 return std::string(); // No files added.
117 } 117 }
118 118
119 FileTemplate NinjaTargetWriter::GetOutputTemplate() const { 119 FileTemplate NinjaTargetWriter::GetOutputTemplate() const {
120 const Target::FileList& outputs = target_->script_values().outputs(); 120 const Target::FileList& outputs = target_->script_values().outputs();
121 std::vector<std::string> output_template_args; 121 std::vector<std::string> output_template_args;
122 for (size_t i = 0; i < outputs.size(); i++) { 122 for (size_t i = 0; i < outputs.size(); i++) {
123 // All outputs should be in the output dir. 123 // All outputs should be in the output dir.
124 output_template_args.push_back( 124 output_template_args.push_back(
125 RemovePrefix(outputs[i].value(), 125 RemovePrefix(outputs[i].value(),
126 settings_->build_settings()->build_dir().value())); 126 settings_->build_settings()->build_dir().value()));
127 } 127 }
128 return FileTemplate(output_template_args); 128 return FileTemplate(output_template_args);
129 } 129 }
OLDNEW
« no previous file with comments | « tools/gn/ninja_group_target_writer.cc ('k') | tools/gn/target.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698