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

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

Issue 2387763002: Support for source_target_relative expansion in GN (Closed)
Patch Set: Rebased Created 4 years 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/function_process_file_template.cc ('k') | tools/gn/ninja_copy_target_writer.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_action_target_writer.h" 5 #include "tools/gn/ninja_action_target_writer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "tools/gn/deps_iterator.h" 10 #include "tools/gn/deps_iterator.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Response files require a unique name be defined. 177 // Response files require a unique name be defined.
178 if (target_->action_values().uses_rsp_file()) 178 if (target_->action_values().uses_rsp_file())
179 out_ << " unique_name = " << i << std::endl; 179 out_ << " unique_name = " << i << std::endl;
180 180
181 // The required types is the union of the args and response file. This 181 // The required types is the union of the args and response file. This
182 // might theoretically duplicate a definition if the same substitution is 182 // might theoretically duplicate a definition if the same substitution is
183 // used in both the args and the reponse file. However, this should be 183 // used in both the args and the reponse file. However, this should be
184 // very unusual (normally the substitutions will go in one place or the 184 // very unusual (normally the substitutions will go in one place or the
185 // other) and the redundant assignment won't bother Ninja. 185 // other) and the redundant assignment won't bother Ninja.
186 SubstitutionWriter::WriteNinjaVariablesForSource( 186 SubstitutionWriter::WriteNinjaVariablesForSource(
187 settings_, sources[i], 187 target_, settings_, sources[i],
188 target_->action_values().args().required_types(), 188 target_->action_values().args().required_types(),
189 args_escape_options, out_); 189 args_escape_options, out_);
190 SubstitutionWriter::WriteNinjaVariablesForSource( 190 SubstitutionWriter::WriteNinjaVariablesForSource(
191 settings_, sources[i], 191 target_, settings_, sources[i],
192 target_->action_values().rsp_file_contents().required_types(), 192 target_->action_values().rsp_file_contents().required_types(),
193 args_escape_options, out_); 193 args_escape_options, out_);
194 194
195 if (target_->action_values().has_depfile()) { 195 if (target_->action_values().has_depfile()) {
196 out_ << " depfile = "; 196 out_ << " depfile = ";
197 WriteDepfile(sources[i]); 197 WriteDepfile(sources[i]);
198 out_ << std::endl; 198 out_ << std::endl;
199 } 199 }
200 } 200 }
201 } 201 }
202 202
203 void NinjaActionTargetWriter::WriteOutputFilesForBuildLine( 203 void NinjaActionTargetWriter::WriteOutputFilesForBuildLine(
204 const SourceFile& source, 204 const SourceFile& source,
205 std::vector<OutputFile>* output_files) { 205 std::vector<OutputFile>* output_files) {
206 size_t first_output_index = output_files->size(); 206 size_t first_output_index = output_files->size();
207 207
208 SubstitutionWriter::ApplyListToSourceAsOutputFile( 208 SubstitutionWriter::ApplyListToSourceAsOutputFile(
209 settings_, target_->action_values().outputs(), source, output_files); 209 target_, settings_, target_->action_values().outputs(), source,
210 output_files);
210 211
211 for (size_t i = first_output_index; i < output_files->size(); i++) { 212 for (size_t i = first_output_index; i < output_files->size(); i++) {
212 out_ << " "; 213 out_ << " ";
213 path_output_.WriteFile(out_, (*output_files)[i]); 214 path_output_.WriteFile(out_, (*output_files)[i]);
214 } 215 }
215 } 216 }
216 217
217 void NinjaActionTargetWriter::WriteDepfile(const SourceFile& source) { 218 void NinjaActionTargetWriter::WriteDepfile(const SourceFile& source) {
218 path_output_.WriteFile(out_, 219 path_output_.WriteFile(out_,
219 SubstitutionWriter::ApplyPatternToSourceAsOutputFile( 220 SubstitutionWriter::ApplyPatternToSourceAsOutputFile(
220 settings_, target_->action_values().depfile(), source)); 221 target_, settings_, target_->action_values().depfile(), source));
221 } 222 }
OLDNEW
« no previous file with comments | « tools/gn/function_process_file_template.cc ('k') | tools/gn/ninja_copy_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698