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
3 // found in the LICENSE file.
5 #include "tools/gn/ninja_group_target_writer.h"
7 #include "base/strings/string_util.h"
8 #include "tools/gn/deps_iterator.h"
9 #include "tools/gn/output_file.h"
10 #include "tools/gn/string_utils.h"
11 #include "tools/gn/target.h"
13 NinjaGroupTargetWriter::NinjaGroupTargetWriter(const Target
* target
,
15 : NinjaTargetWriter(target
, out
) {
18 NinjaGroupTargetWriter::~NinjaGroupTargetWriter() {
21 void NinjaGroupTargetWriter::Run() {
22 // A group rule just generates a stamp file with dependencies on each of
23 // the deps and data_deps in the group.
24 std::vector
<OutputFile
> output_files
;
25 for (DepsIterator
iter(target_
, DepsIterator::LINKED_ONLY
);
26 !iter
.done(); iter
.Advance())
27 output_files
.push_back(iter
.target()->dependency_output_file());
29 std::vector
<OutputFile
> data_output_files
;
30 const LabelTargetVector
& data_deps
= target_
->data_deps();
31 for (size_t i
= 0; i
< data_deps
.size(); i
++)
32 data_output_files
.push_back(data_deps
[i
].ptr
->dependency_output_file());
34 WriteStampForTarget(output_files
, data_output_files
);