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_target_writer.h" | 5 #include "tools/gn/ninja_target_writer.h" |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 target->output_type() == Target::STATIC_LIBRARY || | 71 target->output_type() == Target::STATIC_LIBRARY || |
72 target->output_type() == Target::SHARED_LIBRARY || | 72 target->output_type() == Target::SHARED_LIBRARY || |
73 target->output_type() == Target::SOURCE_SET) { | 73 target->output_type() == Target::SOURCE_SET) { |
74 NinjaBinaryTargetWriter writer(target, toolchain, file); | 74 NinjaBinaryTargetWriter writer(target, toolchain, file); |
75 writer.Run(); | 75 writer.Run(); |
76 } else { | 76 } else { |
77 CHECK(0); | 77 CHECK(0); |
78 } | 78 } |
79 | 79 |
80 std::string contents = file.str(); | 80 std::string contents = file.str(); |
81 file_util::WriteFile(ninja_file, contents.c_str(), | 81 base::WriteFile(ninja_file, contents.c_str(), |
82 static_cast<int>(contents.size())); | 82 static_cast<int>(contents.size())); |
83 } | 83 } |
84 | 84 |
85 std::string NinjaTargetWriter::GetSourcesImplicitDeps() const { | 85 std::string NinjaTargetWriter::GetSourcesImplicitDeps() const { |
86 std::ostringstream ret; | 86 std::ostringstream ret; |
87 ret << " |"; | 87 ret << " |"; |
88 | 88 |
89 // Input files are order-only deps. | 89 // Input files are order-only deps. |
90 const Target::FileList& prereqs = target_->source_prereqs(); | 90 const Target::FileList& prereqs = target_->source_prereqs(); |
91 bool has_files = !prereqs.empty(); | 91 bool has_files = !prereqs.empty(); |
92 for (size_t i = 0; i < prereqs.size(); i++) { | 92 for (size_t i = 0; i < prereqs.size(); i++) { |
(...skipping 20 matching lines...) Expand all Loading... |
113 const Target::FileList& outputs = target_->script_values().outputs(); | 113 const Target::FileList& outputs = target_->script_values().outputs(); |
114 std::vector<std::string> output_template_args; | 114 std::vector<std::string> output_template_args; |
115 for (size_t i = 0; i < outputs.size(); i++) { | 115 for (size_t i = 0; i < outputs.size(); i++) { |
116 // All outputs should be in the output dir. | 116 // All outputs should be in the output dir. |
117 output_template_args.push_back( | 117 output_template_args.push_back( |
118 RemovePrefix(outputs[i].value(), | 118 RemovePrefix(outputs[i].value(), |
119 settings_->build_settings()->build_dir().value())); | 119 settings_->build_settings()->build_dir().value())); |
120 } | 120 } |
121 return FileTemplate(output_template_args); | 121 return FileTemplate(output_template_args); |
122 } | 122 } |
OLD | NEW |