| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } else if (target->output_type() == Target::EXECUTABLE || | 80 } else if (target->output_type() == Target::EXECUTABLE || |
| 81 target->output_type() == Target::STATIC_LIBRARY || | 81 target->output_type() == Target::STATIC_LIBRARY || |
| 82 target->output_type() == Target::SHARED_LIBRARY) { | 82 target->output_type() == Target::SHARED_LIBRARY) { |
| 83 NinjaBinaryTargetWriter writer(target, file); | 83 NinjaBinaryTargetWriter writer(target, file); |
| 84 writer.Run(); | 84 writer.Run(); |
| 85 } else { | 85 } else { |
| 86 CHECK(0); | 86 CHECK(0); |
| 87 } | 87 } |
| 88 | 88 |
| 89 std::string contents = file.str(); | 89 std::string contents = file.str(); |
| 90 file_util::WriteFile(ninja_file, contents.c_str(), contents.size()); | 90 file_util::WriteFile(ninja_file, contents.c_str(), |
| 91 static_cast<int>(contents.size())); |
| 91 } | 92 } |
| 92 | 93 |
| 93 void NinjaTargetWriter::WriteEnvironment() { | 94 void NinjaTargetWriter::WriteEnvironment() { |
| 94 // TODO(brettw) have a better way to do the environment setup on Windows. | 95 // TODO(brettw) have a better way to do the environment setup on Windows. |
| 95 if (target_->settings()->IsWin()) | 96 if (target_->settings()->IsWin()) |
| 96 out_ << "arch = environment.x86\n"; | 97 out_ << "arch = environment.x86\n"; |
| 97 } | 98 } |
| 98 | 99 |
| 99 const Toolchain* NinjaTargetWriter::GetToolchain() const { | 100 const Toolchain* NinjaTargetWriter::GetToolchain() const { |
| 100 return target_->settings()->toolchain(); | 101 return target_->settings()->toolchain(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 131 const Target::FileList& outputs = target_->script_values().outputs(); | 132 const Target::FileList& outputs = target_->script_values().outputs(); |
| 132 std::vector<std::string> output_template_args; | 133 std::vector<std::string> output_template_args; |
| 133 for (size_t i = 0; i < outputs.size(); i++) { | 134 for (size_t i = 0; i < outputs.size(); i++) { |
| 134 // All outputs should be in the output dir. | 135 // All outputs should be in the output dir. |
| 135 output_template_args.push_back( | 136 output_template_args.push_back( |
| 136 RemovePrefix(outputs[i].value(), | 137 RemovePrefix(outputs[i].value(), |
| 137 settings_->build_settings()->build_dir().value())); | 138 settings_->build_settings()->build_dir().value())); |
| 138 } | 139 } |
| 139 return FileTemplate(output_template_args); | 140 return FileTemplate(output_template_args); |
| 140 } | 141 } |
| OLD | NEW |