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

Unified Diff: tools/gn/desc_builder.cc

Issue 2880093002: gn desc: printing public_deps without --all and --tree
Patch Set: Created 3 years, 7 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
Index: tools/gn/desc_builder.cc
diff --git a/tools/gn/desc_builder.cc b/tools/gn/desc_builder.cc
index 965ec921f10a12be760ee51aba699debb71b5a23..9080c3024faffe6df55397290e977f4a8ae9d16a 100644
--- a/tools/gn/desc_builder.cc
+++ b/tools/gn/desc_builder.cc
@@ -406,6 +406,15 @@ class TargetDescBuilder : public BaseDescBuilder {
if (what(variables::kDeps))
res->SetWithoutPathExpansion(variables::kDeps, RenderDeps());
+ // By default RenderDeps only renders Target::DEPS_PRIVATE, in that case
+ // the output should be enriched also with Target::DEPS_PUBLIC.
+ if (!tree_ && !all_) {
+ if (what(variables::kPublicDeps)) {
+ res->SetWithoutPathExpansion(variables::kPublicDeps,
+ RenderPublicDeps());
+ }
+ }
+
// Runtime deps are special, print only when explicitly asked for and not in
// overview mode.
if (what_.find("runtime_deps") != what_.end())
@@ -511,7 +520,7 @@ class TargetDescBuilder : public BaseDescBuilder {
} else {
// Show direct dependencies only.
std::vector<const Target*> deps;
- for (const auto& pair : target_->GetDeps(Target::DEPS_ALL))
+ for (const auto& pair : target_->GetDeps(Target::DEPS_PRIVATE))
deps.push_back(pair.ptr);
std::sort(deps.begin(), deps.end());
commands::FilterAndPrintTargets(&deps, res.get());
@@ -521,6 +530,19 @@ class TargetDescBuilder : public BaseDescBuilder {
return std::move(res);
}
+ ValuePtr RenderPublicDeps() {
+ auto res = base::MakeUnique<base::ListValue>();
+
+ std::vector<const Target*> deps;
+ for (const auto& pair : target_->GetDeps(Target::DEPS_PUBLIC))
+ deps.push_back(pair.ptr);
+
+ std::sort(deps.begin(), deps.end());
+ commands::FilterAndPrintTargets(&deps, res.get());
+
+ return std::move(res);
+ }
+
ValuePtr RenderRuntimeDeps() {
auto res = base::MakeUnique<base::ListValue>();

Powered by Google App Engine
This is Rietveld 408576698