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_toolchain_writer.h" | 5 #include "tools/gn/ninja_toolchain_writer.h" |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/strings/stringize_macros.h" | 10 #include "base/strings/stringize_macros.h" |
11 #include "tools/gn/build_settings.h" | 11 #include "tools/gn/build_settings.h" |
12 #include "tools/gn/settings.h" | 12 #include "tools/gn/settings.h" |
13 #include "tools/gn/target.h" | 13 #include "tools/gn/target.h" |
14 #include "tools/gn/toolchain.h" | 14 #include "tools/gn/toolchain.h" |
15 #include "tools/gn/trace.h" | 15 #include "tools/gn/trace.h" |
16 | 16 |
17 NinjaToolchainWriter::NinjaToolchainWriter( | 17 NinjaToolchainWriter::NinjaToolchainWriter( |
18 const Settings* settings, | 18 const Settings* settings, |
19 const Toolchain* toolchain, | 19 const Toolchain* toolchain, |
20 const std::vector<const Target*>& targets, | 20 const std::vector<const Target*>& targets, |
21 std::ostream& out) | 21 std::ostream& out) |
22 : settings_(settings), | 22 : settings_(settings), |
23 toolchain_(toolchain), | 23 toolchain_(toolchain), |
24 targets_(targets), | 24 targets_(targets), |
25 out_(out), | 25 out_(out), |
26 path_output_(settings_->build_settings()->build_dir(), | 26 path_output_(settings_->build_settings()->build_dir(), |
27 ESCAPE_NINJA, true), | 27 ESCAPE_NINJA, |
| 28 false), |
28 helper_(settings->build_settings()) { | 29 helper_(settings->build_settings()) { |
29 } | 30 } |
30 | 31 |
31 NinjaToolchainWriter::~NinjaToolchainWriter() { | 32 NinjaToolchainWriter::~NinjaToolchainWriter() { |
32 } | 33 } |
33 | 34 |
34 void NinjaToolchainWriter::Run() { | 35 void NinjaToolchainWriter::Run() { |
35 WriteRules(); | 36 WriteRules(); |
36 WriteSubninjas(); | 37 WriteSubninjas(); |
37 } | 38 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void NinjaToolchainWriter::WriteSubninjas() { | 95 void NinjaToolchainWriter::WriteSubninjas() { |
95 // Write subninja commands for each generated target. | 96 // Write subninja commands for each generated target. |
96 for (size_t i = 0; i < targets_.size(); i++) { | 97 for (size_t i = 0; i < targets_.size(); i++) { |
97 OutputFile ninja_file = helper_.GetNinjaFileForTarget(targets_[i]); | 98 OutputFile ninja_file = helper_.GetNinjaFileForTarget(targets_[i]); |
98 out_ << "subninja "; | 99 out_ << "subninja "; |
99 path_output_.WriteFile(out_, ninja_file); | 100 path_output_.WriteFile(out_, ninja_file); |
100 out_ << std::endl; | 101 out_ << std::endl; |
101 } | 102 } |
102 out_ << std::endl; | 103 out_ << std::endl; |
103 } | 104 } |
OLD | NEW |