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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 // static | 105 // static |
106 bool NinjaBuildWriter::RunAndWriteFile( | 106 bool NinjaBuildWriter::RunAndWriteFile( |
107 const BuildSettings* build_settings, | 107 const BuildSettings* build_settings, |
108 const std::vector<const Settings*>& all_settings, | 108 const std::vector<const Settings*>& all_settings, |
109 const std::vector<const Target*>& default_toolchain_targets) { | 109 const std::vector<const Target*>& default_toolchain_targets) { |
110 ScopedTrace trace(TraceItem::TRACE_FILE_WRITE, "build.ninja"); | 110 ScopedTrace trace(TraceItem::TRACE_FILE_WRITE, "build.ninja"); |
111 | 111 |
112 base::FilePath ninja_file(build_settings->GetFullPath( | 112 base::FilePath ninja_file(build_settings->GetFullPath( |
113 SourceFile(build_settings->build_dir().value() + "build.ninja"))); | 113 SourceFile(build_settings->build_dir().value() + "build.ninja"))); |
114 file_util::CreateDirectory(ninja_file.DirName()); | 114 base::CreateDirectory(ninja_file.DirName()); |
115 | 115 |
116 std::ofstream file; | 116 std::ofstream file; |
117 file.open(FilePathToUTF8(ninja_file).c_str(), | 117 file.open(FilePathToUTF8(ninja_file).c_str(), |
118 std::ios_base::out | std::ios_base::binary); | 118 std::ios_base::out | std::ios_base::binary); |
119 if (file.fail()) | 119 if (file.fail()) |
120 return false; | 120 return false; |
121 | 121 |
122 std::ofstream depfile; | 122 std::ofstream depfile; |
123 depfile.open((FilePathToUTF8(ninja_file) + ".d").c_str(), | 123 depfile.open((FilePathToUTF8(ninja_file) + ".d").c_str(), |
124 std::ios_base::out | std::ios_base::binary); | 124 std::ios_base::out | std::ios_base::binary); |
(...skipping 79 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 |