Chromium Code Reviews| Index: tools/gn/target.cc |
| diff --git a/tools/gn/target.cc b/tools/gn/target.cc |
| index 714fd911f9657c038dda56c1b096ded0365d759c..1bd99e8cec4ff488c70d2befce20df55329265f7 100644 |
| --- a/tools/gn/target.cc |
| +++ b/tools/gn/target.cc |
| @@ -125,6 +125,14 @@ bool EnsureFileIsGeneratedByDependency(const Target* target, |
| seen_targets)) |
| return true; // Found a path. |
| } |
| + if (target->output_type() == Target::CREATE_BUNDLE) { |
| + for (const auto& dep : target->bundle_data().deps()) { |
| + if (EnsureFileIsGeneratedByDependency(dep, file, false, |
| + consider_object_files, |
| + seen_targets)) |
| + return true; // Found a path. |
| + } |
| + } |
| } |
| return false; |
| } |
| @@ -481,37 +489,27 @@ void Target::PullRecursiveHardDeps() { |
| } |
| void Target::PullRecursiveBundleData() { |
| - if (output_type_ != CREATE_BUNDLE) |
| - return; |
| - |
| - std::set<const Target*> visited; |
| - std::vector<const Target*> deps; |
| - deps.push_back(this); |
| - |
| - while (!deps.empty()) { |
| - const Target* current = deps.back(); |
| - deps.pop_back(); |
| - |
| - if (visited.find(current) != visited.end()) |
| + UniqueVector<const Target*>& bundle_data_deps = bundle_data_.deps(); |
| + for (const auto& pair : GetDeps(DEPS_LINKED)) { |
| + // Stop recursion at create_bundle targets. |
|
brettw
2016/03/21 22:49:47
This would be more clear to me as something like "
|
| + if (pair.ptr->output_type() == CREATE_BUNDLE) |
| continue; |
| - visited.insert(current); |
| - |
| - if (current->output_type_ == BUNDLE_DATA) |
| - bundle_data_.AddFileRuleFromTarget(current); |
| - for (const LabelTargetPair& pair : current->GetDeps(DEPS_ALL)) { |
| - DCHECK(pair.ptr); |
| - DCHECK(pair.ptr->toolchain_); |
| - if (visited.find(pair.ptr) != visited.end()) |
| - continue; |
| + // Direct dependency on a bundle_data target. |
| + if (pair.ptr->output_type() == BUNDLE_DATA) |
| + bundle_data_deps.push_back(pair.ptr); |
|
brettw
2016/03/21 22:49:47
Extra blank line in here.
|
| - if (pair.ptr->output_type() == CREATE_BUNDLE) |
| - continue; |
| - deps.push_back(pair.ptr); |
| - } |
| + // Recursive bundle_data informations from all dependencies. |
| + bundle_data_deps.Append(pair.ptr->bundle_data().deps().begin(), |
| + pair.ptr->bundle_data().deps().end()); |
| } |
| + if (output_type_ != CREATE_BUNDLE) |
| + return; |
| + |
| + for (const auto& target : bundle_data_.deps()) |
| + bundle_data_.AddFileRuleFromTarget(target); |
|
brettw
2016/03/21 22:49:47
Can this function be changed now? It's weird to pa
brettw
2016/03/21 22:59:08
By this I mean append that target to the bundle_de
sdefresne
2016/03/22 12:34:05
There was a small optimisation that this removed (
|
| bundle_data_.GetSourceFiles(&sources_); |
| } |