Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: tools/gn/target.cc

Issue 1804263003: Consider bundle_data as public_deps of create_bundle targets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@{interstitial}
Patch Set: Second round of comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/bundle_data.cc ('k') | tools/gn/target_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/target.cc
diff --git a/tools/gn/target.cc b/tools/gn/target.cc
index 714fd911f9657c038dda56c1b096ded0365d759c..2386870c5788f4813d635f24450d8e453eab26c4 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().bundle_deps()) {
+ if (EnsureFileIsGeneratedByDependency(dep, file, false,
+ consider_object_files,
+ seen_targets))
+ return true; // Found a path.
+ }
+ }
}
return false;
}
@@ -481,38 +489,21 @@ 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())
+ for (const auto& pair : GetDeps(DEPS_LINKED)) {
+ // Don't propagate bundle_data once they are added to a bundle.
+ 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;
- if (pair.ptr->output_type() == CREATE_BUNDLE)
- continue;
+ // Direct dependency on a bundle_data target.
+ if (pair.ptr->output_type() == BUNDLE_DATA)
+ bundle_data_.AddBundleData(pair.ptr);
- deps.push_back(pair.ptr);
- }
+ // Recursive bundle_data informations from all dependencies.
+ for (const auto& target : pair.ptr->bundle_data().bundle_deps())
+ bundle_data_.AddBundleData(target);
}
- bundle_data_.GetSourceFiles(&sources_);
+ bundle_data_.OnTargetResolved(this);
}
void Target::FillOutputFiles() {
« no previous file with comments | « tools/gn/bundle_data.cc ('k') | tools/gn/target_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698