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

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

Issue 2627703002: Validate GN substitutions in args and rsp files. (Closed)
Patch Set: Format Created 3 years, 11 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/action_target_generator_unittest.cc ('k') | tools/gn/substitution_type.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_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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 path_output_.WriteFile(out_, input_dep); 173 path_output_.WriteFile(out_, input_dep);
174 } 174 }
175 out_ << std::endl; 175 out_ << std::endl;
176 176
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 response 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 target_, 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 target_, 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_);
(...skipping 19 matching lines...) Expand all
213 out_ << " "; 213 out_ << " ";
214 path_output_.WriteFile(out_, (*output_files)[i]); 214 path_output_.WriteFile(out_, (*output_files)[i]);
215 } 215 }
216 } 216 }
217 217
218 void NinjaActionTargetWriter::WriteDepfile(const SourceFile& source) { 218 void NinjaActionTargetWriter::WriteDepfile(const SourceFile& source) {
219 path_output_.WriteFile(out_, 219 path_output_.WriteFile(out_,
220 SubstitutionWriter::ApplyPatternToSourceAsOutputFile( 220 SubstitutionWriter::ApplyPatternToSourceAsOutputFile(
221 target_, settings_, target_->action_values().depfile(), source)); 221 target_, settings_, target_->action_values().depfile(), source));
222 } 222 }
OLDNEW
« no previous file with comments | « tools/gn/action_target_generator_unittest.cc ('k') | tools/gn/substitution_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698