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

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

Issue 213353004: GN: Move towards only using / on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: restore convert_slashes in output path, misc fixes Created 6 years, 8 months 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/ninja_binary_target_writer.cc ('k') | tools/gn/ninja_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 12 matching lines...) Expand all
23 #if defined(OS_WIN) 23 #if defined(OS_WIN)
24 #include <windows.h> 24 #include <windows.h>
25 #endif 25 #endif
26 26
27 namespace { 27 namespace {
28 28
29 std::string GetSelfInvocationCommand(const BuildSettings* build_settings) { 29 std::string GetSelfInvocationCommand(const BuildSettings* build_settings) {
30 base::FilePath executable; 30 base::FilePath executable;
31 PathService::Get(base::FILE_EXE, &executable); 31 PathService::Get(base::FILE_EXE, &executable);
32 32
33 CommandLine cmdline(executable); 33 CommandLine cmdline(executable.NormalizePathSeparatorsTo('/'));
34 cmdline.AppendArg("gen"); 34 cmdline.AppendArg("gen");
35 cmdline.AppendArg(build_settings->build_dir().value()); 35 cmdline.AppendArg(build_settings->build_dir().value());
36 cmdline.AppendSwitchPath("--root", build_settings->root_path()); 36 cmdline.AppendSwitchPath("--root", build_settings->root_path());
37 cmdline.AppendSwitch("-q"); // Don't write output. 37 cmdline.AppendSwitch("-q"); // Don't write output.
38 38
39 EscapeOptions escape_shell; 39 EscapeOptions escape_shell;
40 escape_shell.mode = ESCAPE_SHELL; 40 escape_shell.mode = ESCAPE_SHELL;
41 #if defined(OS_WIN) 41 #if defined(OS_WIN)
42 // The command line code quoting varies by platform. We have one string, 42 // The command line code quoting varies by platform. We have one string,
43 // possibly with spaces, that we want to quote. The Windows command line 43 // possibly with spaces, that we want to quote. The Windows command line
(...skipping 25 matching lines...) Expand all
69 const BuildSettings* build_settings, 69 const BuildSettings* build_settings,
70 const std::vector<const Settings*>& all_settings, 70 const std::vector<const Settings*>& all_settings,
71 const std::vector<const Target*>& default_toolchain_targets, 71 const std::vector<const Target*>& default_toolchain_targets,
72 std::ostream& out, 72 std::ostream& out,
73 std::ostream& dep_out) 73 std::ostream& dep_out)
74 : build_settings_(build_settings), 74 : build_settings_(build_settings),
75 all_settings_(all_settings), 75 all_settings_(all_settings),
76 default_toolchain_targets_(default_toolchain_targets), 76 default_toolchain_targets_(default_toolchain_targets),
77 out_(out), 77 out_(out),
78 dep_out_(dep_out), 78 dep_out_(dep_out),
79 path_output_(build_settings->build_dir(), ESCAPE_NINJA, true), 79 path_output_(build_settings->build_dir(), ESCAPE_NINJA, false),
80 helper_(build_settings) { 80 helper_(build_settings) {
81 } 81 }
82 82
83 NinjaBuildWriter::~NinjaBuildWriter() { 83 NinjaBuildWriter::~NinjaBuildWriter() {
84 } 84 }
85 85
86 void NinjaBuildWriter::Run() { 86 void NinjaBuildWriter::Run() {
87 WriteNinjaRules(); 87 WriteNinjaRules();
88 WriteSubninjas(); 88 WriteSubninjas();
89 WritePhonyAndAllRules(); 89 WritePhonyAndAllRules();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 all_rules.append(" $\n "); 192 all_rules.append(" $\n ");
193 all_rules.append(target_file.value()); 193 all_rules.append(target_file.value());
194 } 194 }
195 195
196 if (!all_rules.empty()) { 196 if (!all_rules.empty()) {
197 out_ << "\nbuild all: phony " << all_rules << std::endl; 197 out_ << "\nbuild all: phony " << all_rules << std::endl;
198 out_ << "default all" << std::endl; 198 out_ << "default all" << std::endl;
199 } 199 }
200 } 200 }
201 201
OLDNEW
« no previous file with comments | « tools/gn/ninja_binary_target_writer.cc ('k') | tools/gn/ninja_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698