| 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_script_target_writer.h" | 5 #include "tools/gn/ninja_script_target_writer.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "tools/gn/err.h" | 8 #include "tools/gn/err.h" |
| 9 #include "tools/gn/file_template.h" | 9 #include "tools/gn/file_template.h" |
| 10 #include "tools/gn/string_utils.h" | 10 #include "tools/gn/string_utils.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 std::string NinjaScriptTargetWriter::WriteRuleDefinition( | 66 std::string NinjaScriptTargetWriter::WriteRuleDefinition( |
| 67 const FileTemplate& args_template) { | 67 const FileTemplate& args_template) { |
| 68 // Make a unique name for this rule. | 68 // Make a unique name for this rule. |
| 69 // | 69 // |
| 70 // Use a unique name for the response file when there are multiple build | 70 // Use a unique name for the response file when there are multiple build |
| 71 // steps so that they don't stomp on each other. When there are no sources, | 71 // steps so that they don't stomp on each other. When there are no sources, |
| 72 // there will be only one invocation so we can use a simple name. | 72 // there will be only one invocation so we can use a simple name. |
| 73 std::string target_label = target_->label().GetUserVisibleName(true); | 73 std::string target_label = target_->label().GetUserVisibleName(true); |
| 74 std::string custom_rule_name(target_label); | 74 std::string custom_rule_name(target_label); |
| 75 ReplaceChars(custom_rule_name, ":/()", "_", &custom_rule_name); | 75 base::ReplaceChars(custom_rule_name, ":/()", "_", &custom_rule_name); |
| 76 custom_rule_name.append("_rule"); | 76 custom_rule_name.append("_rule"); |
| 77 | 77 |
| 78 if (settings_->IsWin()) { | 78 if (settings_->IsWin()) { |
| 79 // Send through gyp-win-tool and use a response file. | 79 // Send through gyp-win-tool and use a response file. |
| 80 std::string rspfile = custom_rule_name; | 80 std::string rspfile = custom_rule_name; |
| 81 if (has_sources()) | 81 if (has_sources()) |
| 82 rspfile += ".$unique_name"; | 82 rspfile += ".$unique_name"; |
| 83 rspfile += ".rsp"; | 83 rspfile += ".rsp"; |
| 84 | 84 |
| 85 out_ << "rule " << custom_rule_name << std::endl; | 85 out_ << "rule " << custom_rule_name << std::endl; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 204 } |
| 205 | 205 |
| 206 FileTemplate NinjaScriptTargetWriter::GetDepfileTemplate() const { | 206 FileTemplate NinjaScriptTargetWriter::GetDepfileTemplate() const { |
| 207 std::vector<std::string> template_args; | 207 std::vector<std::string> template_args; |
| 208 std::string depfile_relative_to_build_dir = | 208 std::string depfile_relative_to_build_dir = |
| 209 RemovePrefix(target_->script_values().depfile().value(), | 209 RemovePrefix(target_->script_values().depfile().value(), |
| 210 settings_->build_settings()->build_dir().value()); | 210 settings_->build_settings()->build_dir().value()); |
| 211 template_args.push_back(depfile_relative_to_build_dir); | 211 template_args.push_back(depfile_relative_to_build_dir); |
| 212 return FileTemplate(template_args); | 212 return FileTemplate(template_args); |
| 213 } | 213 } |
| OLD | NEW |