| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 writer.Run(); | 78 writer.Run(); |
| 79 } else { | 79 } else { |
| 80 CHECK(0); | 80 CHECK(0); |
| 81 } | 81 } |
| 82 | 82 |
| 83 std::string contents = file.str(); | 83 std::string contents = file.str(); |
| 84 file_util::WriteFile(ninja_file, contents.c_str(), | 84 file_util::WriteFile(ninja_file, contents.c_str(), |
| 85 static_cast<int>(contents.size())); | 85 static_cast<int>(contents.size())); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void NinjaTargetWriter::WriteEnvironment() { | |
| 89 // TODO(brettw) have a better way to do the environment setup on Windows. | |
| 90 if (target_->settings()->IsWin()) | |
| 91 out_ << "arch = environment.x86\n"; | |
| 92 } | |
| 93 | |
| 94 const Toolchain* NinjaTargetWriter::GetToolchain() const { | 88 const Toolchain* NinjaTargetWriter::GetToolchain() const { |
| 95 return target_->settings()->toolchain(); | 89 return target_->settings()->toolchain(); |
| 96 } | 90 } |
| 97 | 91 |
| 98 std::string NinjaTargetWriter::GetSourcesImplicitDeps() const { | 92 std::string NinjaTargetWriter::GetSourcesImplicitDeps() const { |
| 99 std::ostringstream ret; | 93 std::ostringstream ret; |
| 100 ret << " |"; | 94 ret << " |"; |
| 101 | 95 |
| 102 // Input files are order-only deps. | 96 // Input files are order-only deps. |
| 103 const Target::FileList& prereqs = target_->source_prereqs(); | 97 const Target::FileList& prereqs = target_->source_prereqs(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 126 const Target::FileList& outputs = target_->script_values().outputs(); | 120 const Target::FileList& outputs = target_->script_values().outputs(); |
| 127 std::vector<std::string> output_template_args; | 121 std::vector<std::string> output_template_args; |
| 128 for (size_t i = 0; i < outputs.size(); i++) { | 122 for (size_t i = 0; i < outputs.size(); i++) { |
| 129 // All outputs should be in the output dir. | 123 // All outputs should be in the output dir. |
| 130 output_template_args.push_back( | 124 output_template_args.push_back( |
| 131 RemovePrefix(outputs[i].value(), | 125 RemovePrefix(outputs[i].value(), |
| 132 settings_->build_settings()->build_dir().value())); | 126 settings_->build_settings()->build_dir().value())); |
| 133 } | 127 } |
| 134 return FileTemplate(output_template_args); | 128 return FileTemplate(output_template_args); |
| 135 } | 129 } |
| OLD | NEW |