| OLD | NEW |
| 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_script_target_writer.h" | 5 #include "tools/gn/ninja_script_target_writer.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "tools/gn/err.h" | 8 #include "tools/gn/err.h" |
| 9 #include "tools/gn/file_template.h" | 9 #include "tools/gn/file_template.h" |
| 10 #include "tools/gn/string_utils.h" | 10 #include "tools/gn/string_utils.h" |
| 11 #include "tools/gn/target.h" | 11 #include "tools/gn/target.h" |
| 12 | 12 |
| 13 NinjaScriptTargetWriter::NinjaScriptTargetWriter(const Target* target, | 13 NinjaScriptTargetWriter::NinjaScriptTargetWriter(const Target* target, |
| 14 std::ostream& out) | 14 std::ostream& out) |
| 15 : NinjaTargetWriter(target, out), | 15 : NinjaTargetWriter(target, out), |
| 16 path_output_no_escaping_( | 16 path_output_no_escaping_( |
| 17 target->settings()->build_settings()->build_dir(), | 17 target->settings()->build_settings()->build_dir(), |
| 18 ESCAPE_NONE, false) { | 18 ESCAPE_NONE, false) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 NinjaScriptTargetWriter::~NinjaScriptTargetWriter() { | 21 NinjaScriptTargetWriter::~NinjaScriptTargetWriter() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 void NinjaScriptTargetWriter::Run() { | 24 void NinjaScriptTargetWriter::Run() { |
| 25 WriteEnvironment(); | |
| 26 | |
| 27 FileTemplate args_template(target_->script_values().args()); | 25 FileTemplate args_template(target_->script_values().args()); |
| 28 std::string custom_rule_name = WriteRuleDefinition(args_template); | 26 std::string custom_rule_name = WriteRuleDefinition(args_template); |
| 29 std::string implicit_deps = GetSourcesImplicitDeps(); | 27 std::string implicit_deps = GetSourcesImplicitDeps(); |
| 30 | 28 |
| 31 // Collects all output files for writing below. | 29 // Collects all output files for writing below. |
| 32 std::vector<OutputFile> output_files; | 30 std::vector<OutputFile> output_files; |
| 33 | 31 |
| 34 if (has_sources()) { | 32 if (has_sources()) { |
| 35 // Write separate build lines for each input source file. | 33 // Write separate build lines for each input source file. |
| 36 WriteSourceRules(custom_rule_name, implicit_deps, args_template, | 34 WriteSourceRules(custom_rule_name, implicit_deps, args_template, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 std::vector<OutputFile>* output_files) { | 164 std::vector<OutputFile>* output_files) { |
| 167 std::vector<std::string> output_template_result; | 165 std::vector<std::string> output_template_result; |
| 168 output_template.ApplyString(source.value(), &output_template_result); | 166 output_template.ApplyString(source.value(), &output_template_result); |
| 169 for (size_t out_i = 0; out_i < output_template_result.size(); out_i++) { | 167 for (size_t out_i = 0; out_i < output_template_result.size(); out_i++) { |
| 170 OutputFile output_path(output_template_result[out_i]); | 168 OutputFile output_path(output_template_result[out_i]); |
| 171 output_files->push_back(output_path); | 169 output_files->push_back(output_path); |
| 172 out_ << " "; | 170 out_ << " "; |
| 173 path_output_.WriteFile(out_, output_path); | 171 path_output_.WriteFile(out_, output_path); |
| 174 } | 172 } |
| 175 } | 173 } |
| OLD | NEW |