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

Unified Diff: tools/gn/command_gen.cc

Issue 1270603004: Add toolchains to dependency error messages in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_gen.cc
diff --git a/tools/gn/command_gen.cc b/tools/gn/command_gen.cc
index eceb8df09f867c28ed8a45733e8a01b418ee016a..56d3e98524b74a3102b91638a118f03e4e6f24f5 100644
--- a/tools/gn/command_gen.cc
+++ b/tools/gn/command_gen.cc
@@ -71,18 +71,34 @@ void PrintInvalidGeneratedInput(const Builder* builder,
const std::vector<const Target*>& targets) {
std::string err;
+ // Only show the toolchain labels (which can be confusing) if something
+ // isn't the default.
+ bool show_toolchains = false;
+ const Label& default_toolchain =
+ targets[0]->settings()->default_toolchain_label();
+ for (const Target* target : targets) {
+ if (target->settings()->toolchain_label() != default_toolchain) {
+ show_toolchains = true;
+ break;
+ }
+ }
+
+ const Target* generator = FindTargetThatGeneratesFile(builder, file);
+ if (generator &&
+ generator->settings()->toolchain_label() != default_toolchain)
+ show_toolchains = true;
+
const std::string target_str = targets.size() > 1 ? "targets" : "target";
err += "The file:\n";
err += " " + file.value() + "\n";
err += "is listed as an input or source for the " + target_str + ":\n";
for (const Target* target : targets)
- err += " " + target->label().GetUserVisibleName(false) + "\n";
+ err += " " + target->label().GetUserVisibleName(show_toolchains) + "\n";
- const Target* generator = FindTargetThatGeneratesFile(builder, file);
if (generator) {
err += "but this file was not generated by any dependencies of the " +
target_str + ". The target\nthat generates the file is:\n ";
- err += generator->label().GetUserVisibleName(false);
+ err += generator->label().GetUserVisibleName(show_toolchains);
} else {
err += "but no targets in the build generate that file.";
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698