| 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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/strings/stringize_macros.h" | 10 #include "base/strings/stringize_macros.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 NinjaToolchainWriter::~NinjaToolchainWriter() { | 39 NinjaToolchainWriter::~NinjaToolchainWriter() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 void NinjaToolchainWriter::Run( | 42 void NinjaToolchainWriter::Run( |
| 43 const std::vector<NinjaWriter::TargetRulePair>& rules) { | 43 const std::vector<NinjaWriter::TargetRulePair>& rules) { |
| 44 std::string rule_prefix = GetNinjaRulePrefixForToolchain(settings_); | 44 std::string rule_prefix = GetNinjaRulePrefixForToolchain(settings_); |
| 45 | 45 |
| 46 for (int i = Toolchain::TYPE_NONE + 1; i < Toolchain::TYPE_NUMTYPES; i++) { | 46 for (int i = Toolchain::TYPE_NONE + 1; i < Toolchain::TYPE_NUMTYPES; i++) { |
| 47 Toolchain::ToolType tool_type = static_cast<Toolchain::ToolType>(i); | 47 Toolchain::ToolType tool_type = static_cast<Toolchain::ToolType>(i); |
| 48 const Tool* tool = toolchain_->GetTool(tool_type); | 48 const Tool* tool = toolchain_->GetTool(tool_type); |
| 49 if (tool_type == Toolchain::TYPE_ACTION) |
| 50 continue; |
| 49 if (tool) | 51 if (tool) |
| 50 WriteToolRule(tool_type, tool, rule_prefix); | 52 WriteToolRule(tool_type, tool, rule_prefix); |
| 51 } | 53 } |
| 52 out_ << std::endl; | 54 out_ << std::endl; |
| 53 | 55 |
| 54 for (const auto& pair : rules) | 56 for (const auto& pair : rules) |
| 55 out_ << pair.second; | 57 out_ << pair.second; |
| 56 } | 58 } |
| 57 | 59 |
| 58 // static | 60 // static |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 120 |
| 119 void NinjaToolchainWriter::WriteRulePattern(const char* name, | 121 void NinjaToolchainWriter::WriteRulePattern(const char* name, |
| 120 const SubstitutionPattern& pattern, | 122 const SubstitutionPattern& pattern, |
| 121 const EscapeOptions& options) { | 123 const EscapeOptions& options) { |
| 122 if (pattern.empty()) | 124 if (pattern.empty()) |
| 123 return; | 125 return; |
| 124 out_ << kIndent << name << " = "; | 126 out_ << kIndent << name << " = "; |
| 125 SubstitutionWriter::WriteWithNinjaVariables(pattern, options, out_); | 127 SubstitutionWriter::WriteWithNinjaVariables(pattern, options, out_); |
| 126 out_ << std::endl; | 128 out_ << std::endl; |
| 127 } | 129 } |
| OLD | NEW |