Display toolchain name in dependency cycle error message.
When a dependency cycle is detected, GN would print the cycle without
toolchain labels for each target, which can make the output confusing,
masking the real error. For example, consider something like:
//foo/bar --> //foo/bar(//toolchain:zoo) --> //foo/bar
GN used to print:
ERROR: Dependency cycle:
//foo/bar ->
//foo/bar ->
//foo/bar
Which completely masked the issue. This patch forces the error message
to include the label with the toolchain.
Change-Id: If22fdfa6ecc0ac0a83115ad328fba61fa80e2abc
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/10720
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: David Turner <digit@google.com>
diff --git a/src/gn/builder.cc b/src/gn/builder.cc
index 9193eb6..0634935 100644
--- a/src/gn/builder.cc
+++ b/src/gn/builder.cc
@@ -592,7 +592,7 @@
std::string ret;
for (size_t i = 0; i < cycle.size(); i++) {
- ret += " " + cycle[i]->label().GetUserVisibleName(false);
+ ret += " " + cycle[i]->label().GetUserVisibleName(loader_->GetDefaultToolchain());
if (i != cycle.size() - 1)
ret += " ->";
ret += "\n";