| 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_group_target_writer.h" | 5 #include "tools/gn/ninja_group_target_writer.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "tools/gn/string_utils.h" | 8 #include "tools/gn/string_utils.h" |
| 9 | 9 |
| 10 NinjaGroupTargetWriter::NinjaGroupTargetWriter(const Target* target, | 10 NinjaGroupTargetWriter::NinjaGroupTargetWriter(const Target* target, |
| 11 const Toolchain* toolchain, |
| 11 std::ostream& out) | 12 std::ostream& out) |
| 12 : NinjaTargetWriter(target, out) { | 13 : NinjaTargetWriter(target, toolchain, out) { |
| 13 } | 14 } |
| 14 | 15 |
| 15 NinjaGroupTargetWriter::~NinjaGroupTargetWriter() { | 16 NinjaGroupTargetWriter::~NinjaGroupTargetWriter() { |
| 16 } | 17 } |
| 17 | 18 |
| 18 void NinjaGroupTargetWriter::Run() { | 19 void NinjaGroupTargetWriter::Run() { |
| 19 // A group rule just generates a stamp file with dependencies on each of | 20 // A group rule just generates a stamp file with dependencies on each of |
| 20 // the deps in the group. | 21 // the deps in the group. |
| 21 out_ << std::endl << "build "; | 22 out_ << std::endl << "build "; |
| 22 path_output_.WriteFile(out_, helper_.GetTargetOutputFile(target_)); | 23 path_output_.WriteFile(out_, helper_.GetTargetOutputFile(target_)); |
| 23 out_ << ": " | 24 out_ << ": " |
| 24 << helper_.GetRulePrefix(target_->settings()->toolchain()) | 25 << helper_.GetRulePrefix(target_->settings()) |
| 25 << "stamp"; | 26 << "stamp"; |
| 26 | 27 |
| 27 const LabelTargetVector& deps = target_->deps(); | 28 const LabelTargetVector& deps = target_->deps(); |
| 28 for (size_t i = 0; i < deps.size(); i++) { | 29 for (size_t i = 0; i < deps.size(); i++) { |
| 29 out_ << " "; | 30 out_ << " "; |
| 30 path_output_.WriteFile(out_, helper_.GetTargetOutputFile(deps[i].ptr)); | 31 path_output_.WriteFile(out_, helper_.GetTargetOutputFile(deps[i].ptr)); |
| 31 } | 32 } |
| 32 | 33 |
| 33 const LabelTargetVector& datadeps = target_->datadeps(); | 34 const LabelTargetVector& datadeps = target_->datadeps(); |
| 34 for (size_t i = 0; i < datadeps.size(); i++) { | 35 for (size_t i = 0; i < datadeps.size(); i++) { |
| 35 out_ << " "; | 36 out_ << " "; |
| 36 path_output_.WriteFile(out_, helper_.GetTargetOutputFile(datadeps[i].ptr)); | 37 path_output_.WriteFile(out_, helper_.GetTargetOutputFile(datadeps[i].ptr)); |
| 37 } | 38 } |
| 38 out_ << std::endl; | 39 out_ << std::endl; |
| 39 } | 40 } |
| OLD | NEW |