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_build_writer.h" | 5 #include "tools/gn/ninja_build_writer.h" |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const Toolchain* default_toolchain, | 79 const Toolchain* default_toolchain, |
80 const std::vector<const Target*>& default_toolchain_targets, | 80 const std::vector<const Target*>& default_toolchain_targets, |
81 std::ostream& out, | 81 std::ostream& out, |
82 std::ostream& dep_out) | 82 std::ostream& dep_out) |
83 : build_settings_(build_settings), | 83 : build_settings_(build_settings), |
84 all_settings_(all_settings), | 84 all_settings_(all_settings), |
85 default_toolchain_(default_toolchain), | 85 default_toolchain_(default_toolchain), |
86 default_toolchain_targets_(default_toolchain_targets), | 86 default_toolchain_targets_(default_toolchain_targets), |
87 out_(out), | 87 out_(out), |
88 dep_out_(dep_out), | 88 dep_out_(dep_out), |
89 path_output_(build_settings->build_dir(), ESCAPE_NINJA) { | 89 path_output_(build_settings->build_dir(), |
| 90 build_settings->root_path_utf8(), ESCAPE_NINJA) { |
90 } | 91 } |
91 | 92 |
92 NinjaBuildWriter::~NinjaBuildWriter() { | 93 NinjaBuildWriter::~NinjaBuildWriter() { |
93 } | 94 } |
94 | 95 |
95 bool NinjaBuildWriter::Run(Err* err) { | 96 bool NinjaBuildWriter::Run(Err* err) { |
96 WriteNinjaRules(); | 97 WriteNinjaRules(); |
97 WriteLinkPool(); | 98 WriteLinkPool(); |
98 WriteSubninjas(); | 99 WriteSubninjas(); |
99 return WritePhonyAndAllRules(err); | 100 return WritePhonyAndAllRules(err); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 EscapeOptions ninja_escape; | 267 EscapeOptions ninja_escape; |
267 ninja_escape.mode = ESCAPE_NINJA; | 268 ninja_escape.mode = ESCAPE_NINJA; |
268 | 269 |
269 // Escape for special chars Ninja will handle. | 270 // Escape for special chars Ninja will handle. |
270 std::string escaped = EscapeString(phony_name, ninja_escape, NULL); | 271 std::string escaped = EscapeString(phony_name, ninja_escape, NULL); |
271 | 272 |
272 out_ << "build " << escaped << ": phony "; | 273 out_ << "build " << escaped << ": phony "; |
273 path_output_.WriteFile(out_, target_file); | 274 path_output_.WriteFile(out_, target_file); |
274 out_ << std::endl; | 275 out_ << std::endl; |
275 } | 276 } |
OLD | NEW |