| 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_toolchain_writer.h" | 5 #include "tools/gn/ninja_toolchain_writer.h" |
| 6 | 6 |
| 7 #include <fstream> | 7 #include <fstream> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/strings/stringize_macros.h" | 10 #include "base/strings/stringize_macros.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 continue; | 72 continue; |
| 73 | 73 |
| 74 out_ << "rule " << rule_prefix << Toolchain::ToolTypeToName(tool_type) | 74 out_ << "rule " << rule_prefix << Toolchain::ToolTypeToName(tool_type) |
| 75 << std::endl; | 75 << std::endl; |
| 76 | 76 |
| 77 #define WRITE_ARG(name) \ | 77 #define WRITE_ARG(name) \ |
| 78 if (!tool.name.empty()) \ | 78 if (!tool.name.empty()) \ |
| 79 out_ << indent << " " STRINGIZE(name) " = " << tool.name << std::endl; | 79 out_ << indent << " " STRINGIZE(name) " = " << tool.name << std::endl; |
| 80 WRITE_ARG(command); | 80 WRITE_ARG(command); |
| 81 WRITE_ARG(depfile); | 81 WRITE_ARG(depfile); |
| 82 WRITE_ARG(deps); | |
| 83 WRITE_ARG(description); | 82 WRITE_ARG(description); |
| 84 WRITE_ARG(pool); | 83 WRITE_ARG(pool); |
| 85 WRITE_ARG(restat); | 84 WRITE_ARG(restat); |
| 86 WRITE_ARG(rspfile); | 85 WRITE_ARG(rspfile); |
| 87 WRITE_ARG(rspfile_content); | 86 WRITE_ARG(rspfile_content); |
| 88 #undef WRITE_ARG | 87 #undef WRITE_ARG |
| 88 |
| 89 // Deps is called "depsformat" in GN to avoid confusion with dependencies. |
| 90 if (!tool.depsformat.empty()) \ |
| 91 out_ << indent << " deps = " << tool.depsformat << std::endl; |
| 89 } | 92 } |
| 90 out_ << std::endl; | 93 out_ << std::endl; |
| 91 } | 94 } |
| 92 | 95 |
| 93 void NinjaToolchainWriter::WriteSubninjas() { | 96 void NinjaToolchainWriter::WriteSubninjas() { |
| 94 // Write subninja commands for each generated target. | 97 // Write subninja commands for each generated target. |
| 95 for (size_t i = 0; i < targets_.size(); i++) { | 98 for (size_t i = 0; i < targets_.size(); i++) { |
| 96 OutputFile ninja_file = helper_.GetNinjaFileForTarget(targets_[i]); | 99 OutputFile ninja_file = helper_.GetNinjaFileForTarget(targets_[i]); |
| 97 out_ << "subninja "; | 100 out_ << "subninja "; |
| 98 path_output_.WriteFile(out_, ninja_file); | 101 path_output_.WriteFile(out_, ninja_file); |
| 99 out_ << std::endl; | 102 out_ << std::endl; |
| 100 } | 103 } |
| 101 out_ << std::endl; | 104 out_ << std::endl; |
| 102 } | 105 } |
| OLD | NEW |