1 // Copyright 2018 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.
4
5 #include "gn/metadata_walk.h"
6
WalkMetadata(const UniqueVector<const Target * > & targets_to_walk,const std::vector<std::string> & keys_to_extract,const std::vector<std::string> & keys_to_walk,const SourceDir & rebase_dir,TargetSet * targets_walked,Err * err)7 std::vector<Value> WalkMetadata(
8 const UniqueVector<const Target*>& targets_to_walk,
9 const std::vector<std::string>& keys_to_extract,
10 const std::vector<std::string>& keys_to_walk,
11 const SourceDir& rebase_dir,
12 TargetSet* targets_walked,
13 Err* err) {
14 std::vector<Value> result;
15 for (const auto* target : targets_to_walk) {
16 if (targets_walked->add(target)) {
17 if (!target->GetMetadata(keys_to_extract, keys_to_walk, rebase_dir, false,
18 &result, targets_walked, err))
19 return std::vector<Value>();
20 }
21 }
22 return result;
23 }
24