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 | 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 11 matching lines...) Expand all Loading... |
22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
23 #include <windows.h> | 23 #include <windows.h> |
24 #endif | 24 #endif |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 std::string GetSelfInvocationCommand(const BuildSettings* build_settings) { | 28 std::string GetSelfInvocationCommand(const BuildSettings* build_settings) { |
29 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
30 wchar_t module[MAX_PATH]; | 30 wchar_t module[MAX_PATH]; |
31 GetModuleFileName(NULL, module, MAX_PATH); | 31 GetModuleFileName(NULL, module, MAX_PATH); |
32 //result = "\"" + WideToUTF8(module) + "\""; | 32 //result = "\"" + base::WideToUTF8(module) + "\""; |
33 base::FilePath executable(module); | 33 base::FilePath executable(module); |
34 #elif defined(OS_MACOSX) | 34 #elif defined(OS_MACOSX) |
35 // FIXME(brettw) write this on Mac! | 35 // FIXME(brettw) write this on Mac! |
36 base::FilePath executable("../Debug/gn"); | 36 base::FilePath executable("../Debug/gn"); |
37 #else | 37 #else |
38 base::FilePath executable = | 38 base::FilePath executable = |
39 base::GetProcessExecutablePath(base::GetCurrentProcessHandle()); | 39 base::GetProcessExecutablePath(base::GetCurrentProcessHandle()); |
40 #endif | 40 #endif |
41 | 41 |
42 /* | 42 /* |
(...skipping 20 matching lines...) Expand all Loading... |
63 for (CommandLine::SwitchMap::const_iterator i = switches.begin(); | 63 for (CommandLine::SwitchMap::const_iterator i = switches.begin(); |
64 i != switches.end(); ++i) { | 64 i != switches.end(); ++i) { |
65 if (i->first != "q" && i->first != "root") { | 65 if (i->first != "q" && i->first != "root") { |
66 std::string escaped_value = | 66 std::string escaped_value = |
67 EscapeString(FilePathToUTF8(i->second), escape_shell, NULL); | 67 EscapeString(FilePathToUTF8(i->second), escape_shell, NULL); |
68 cmdline.AppendSwitchASCII(i->first, escaped_value); | 68 cmdline.AppendSwitchASCII(i->first, escaped_value); |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 #if defined(OS_WIN) | 72 #if defined(OS_WIN) |
73 return WideToUTF8(cmdline.GetCommandLineString()); | 73 return base::WideToUTF8(cmdline.GetCommandLineString()); |
74 #else | 74 #else |
75 return cmdline.GetCommandLineString(); | 75 return cmdline.GetCommandLineString(); |
76 #endif | 76 #endif |
77 } | 77 } |
78 | 78 |
79 } // namespace | 79 } // namespace |
80 | 80 |
81 NinjaBuildWriter::NinjaBuildWriter( | 81 NinjaBuildWriter::NinjaBuildWriter( |
82 const BuildSettings* build_settings, | 82 const BuildSettings* build_settings, |
83 const std::vector<const Settings*>& all_settings, | 83 const std::vector<const Settings*>& all_settings, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 all_rules.append(" $\n "); | 204 all_rules.append(" $\n "); |
205 all_rules.append(target_file.value()); | 205 all_rules.append(target_file.value()); |
206 } | 206 } |
207 | 207 |
208 if (!all_rules.empty()) { | 208 if (!all_rules.empty()) { |
209 out_ << "\nbuild all: phony " << all_rules << std::endl; | 209 out_ << "\nbuild all: phony " << all_rules << std::endl; |
210 out_ << "default all" << std::endl; | 210 out_ << "default all" << std::endl; |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
OLD | NEW |