OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/substitution_writer.h" | 5 #include "tools/gn/substitution_writer.h" |
6 | 6 |
7 #include "tools/gn/build_settings.h" | 7 #include "tools/gn/build_settings.h" |
8 #include "tools/gn/escape.h" | 8 #include "tools/gn/escape.h" |
9 #include "tools/gn/filesystem_utils.h" | 9 #include "tools/gn/filesystem_utils.h" |
10 #include "tools/gn/output_file.h" | 10 #include "tools/gn/output_file.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 // static | 304 // static |
305 void SubstitutionWriter::WriteNinjaVariablesForSource( | 305 void SubstitutionWriter::WriteNinjaVariablesForSource( |
306 const Settings* settings, | 306 const Settings* settings, |
307 const SourceFile& source, | 307 const SourceFile& source, |
308 const std::vector<SubstitutionType>& types, | 308 const std::vector<SubstitutionType>& types, |
309 const EscapeOptions& escape_options, | 309 const EscapeOptions& escape_options, |
310 std::ostream& out) { | 310 std::ostream& out) { |
311 for (const auto& type : types) { | 311 for (const auto& type : types) { |
312 // Don't write SOURCE since that just maps to Ninja's $in variable, which | 312 // Don't write SOURCE since that just maps to Ninja's $in variable, which |
313 // is implicit in the rule. | 313 // is implicit in the rule. RESPONSE_FILE_NAME is written separately |
314 if (type != SUBSTITUTION_SOURCE) { | 314 // only when writing target rules since it can never be used in any |
| 315 // other context (like process_file_template). |
| 316 if (type != SUBSTITUTION_SOURCE && type != SUBSTITUTION_RSP_FILE_NAME) { |
315 out << " " << kSubstitutionNinjaNames[type] << " = "; | 317 out << " " << kSubstitutionNinjaNames[type] << " = "; |
316 EscapeStringToStream( | 318 EscapeStringToStream( |
317 out, | 319 out, |
318 GetSourceSubstitution(settings, source, type, OUTPUT_RELATIVE, | 320 GetSourceSubstitution(settings, source, type, OUTPUT_RELATIVE, |
319 settings->build_settings()->build_dir()), | 321 settings->build_settings()->build_dir()), |
320 escape_options); | 322 escape_options); |
321 out << std::endl; | 323 out << std::endl; |
322 } | 324 } |
323 } | 325 } |
324 } | 326 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 // does not include the dot but the tool's does. | 552 // does not include the dot but the tool's does. |
551 if (target->output_extension().empty()) | 553 if (target->output_extension().empty()) |
552 return tool->default_output_extension(); | 554 return tool->default_output_extension(); |
553 return std::string(".") + target->output_extension(); | 555 return std::string(".") + target->output_extension(); |
554 | 556 |
555 default: | 557 default: |
556 NOTREACHED(); | 558 NOTREACHED(); |
557 return std::string(); | 559 return std::string(); |
558 } | 560 } |
559 } | 561 } |
OLD | NEW |