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_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" |
11 #include "tools/gn/err.h" | 11 #include "tools/gn/err.h" |
12 #include "tools/gn/file_template.h" | 12 #include "tools/gn/file_template.h" |
13 #include "tools/gn/ninja_action_target_writer.h" | 13 #include "tools/gn/ninja_action_target_writer.h" |
14 #include "tools/gn/ninja_binary_target_writer.h" | 14 #include "tools/gn/ninja_binary_target_writer.h" |
15 #include "tools/gn/ninja_copy_target_writer.h" | 15 #include "tools/gn/ninja_copy_target_writer.h" |
16 #include "tools/gn/ninja_group_target_writer.h" | 16 #include "tools/gn/ninja_group_target_writer.h" |
17 #include "tools/gn/scheduler.h" | 17 #include "tools/gn/scheduler.h" |
18 #include "tools/gn/string_utils.h" | 18 #include "tools/gn/string_utils.h" |
19 #include "tools/gn/target.h" | 19 #include "tools/gn/target.h" |
20 #include "tools/gn/trace.h" | 20 #include "tools/gn/trace.h" |
21 | 21 |
22 NinjaTargetWriter::NinjaTargetWriter(const Target* target, | 22 NinjaTargetWriter::NinjaTargetWriter(const Target* target, |
23 const Toolchain* toolchain, | 23 const Toolchain* toolchain, |
24 std::ostream& out) | 24 std::ostream& out) |
25 : settings_(target->settings()), | 25 : settings_(target->settings()), |
26 target_(target), | 26 target_(target), |
27 toolchain_(toolchain), | 27 toolchain_(toolchain), |
28 out_(out), | 28 out_(out), |
29 path_output_(settings_->build_settings()->build_dir(), | 29 path_output_(settings_->build_settings()->build_dir(), |
30 ESCAPE_NINJA, true), | 30 ESCAPE_NINJA, |
| 31 false), |
31 helper_(settings_->build_settings()) { | 32 helper_(settings_->build_settings()) { |
32 } | 33 } |
33 | 34 |
34 NinjaTargetWriter::~NinjaTargetWriter() { | 35 NinjaTargetWriter::~NinjaTargetWriter() { |
35 } | 36 } |
36 | 37 |
37 // static | 38 // static |
38 void NinjaTargetWriter::RunAndWriteFile(const Target* target, | 39 void NinjaTargetWriter::RunAndWriteFile(const Target* target, |
39 const Toolchain* toolchain) { | 40 const Toolchain* toolchain) { |
40 const Settings* settings = target->settings(); | 41 const Settings* settings = target->settings(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 const Target::FileList& outputs = target_->action_values().outputs(); | 115 const Target::FileList& outputs = target_->action_values().outputs(); |
115 std::vector<std::string> output_template_args; | 116 std::vector<std::string> output_template_args; |
116 for (size_t i = 0; i < outputs.size(); i++) { | 117 for (size_t i = 0; i < outputs.size(); i++) { |
117 // All outputs should be in the output dir. | 118 // All outputs should be in the output dir. |
118 output_template_args.push_back( | 119 output_template_args.push_back( |
119 RemovePrefix(outputs[i].value(), | 120 RemovePrefix(outputs[i].value(), |
120 settings_->build_settings()->build_dir().value())); | 121 settings_->build_settings()->build_dir().value())); |
121 } | 122 } |
122 return FileTemplate(output_template_args); | 123 return FileTemplate(output_template_args); |
123 } | 124 } |
OLD | NEW |