Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tools/gn/ninja_build_writer.cc

Issue 630223002: gn: Support build directories outside the source tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated patch set Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698