| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tools/gn/builder.h" | 5 #include "tools/gn/builder.h" |
| 6 | 6 |
| 7 #include "tools/gn/config.h" | 7 #include "tools/gn/config.h" |
| 8 #include "tools/gn/err.h" | 8 #include "tools/gn/err.h" |
| 9 #include "tools/gn/loader.h" | 9 #include "tools/gn/loader.h" |
| 10 #include "tools/gn/scheduler.h" | 10 #include "tools/gn/scheduler.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 for (size_t dep_i = 0; dep_i < deps.size(); dep_i++) { | 440 for (size_t dep_i = 0; dep_i < deps.size(); dep_i++) { |
| 441 if (configs[config_i].label == deps[dep_i].label) { | 441 if (configs[config_i].label == deps[dep_i].label) { |
| 442 DCHECK(deps[dep_i].ptr); // Should already be resolved. | 442 DCHECK(deps[dep_i].ptr); // Should already be resolved. |
| 443 configs[config_i].ptr = deps[dep_i].ptr; | 443 configs[config_i].ptr = deps[dep_i].ptr; |
| 444 break; | 444 break; |
| 445 } | 445 } |
| 446 } | 446 } |
| 447 if (!configs[config_i].ptr) { | 447 if (!configs[config_i].ptr) { |
| 448 *err = Err(target->defined_from(), | 448 *err = Err(target->defined_from(), |
| 449 "Target in forward_dependent_configs_from was not listed in the deps", | 449 "Target in forward_dependent_configs_from was not listed in the deps", |
| 450 "The target \"" + configs[config_i].label.GetUserVisibleName(false) + | 450 "This target has a forward_dependent_configs_from entry that was " |
| 451 "\"\n was not present in the deps. This thing is used to forward\n" | 451 "not present in\nthe deps. A target can only forward things it " |
| 452 "configs from direct dependents."); | 452 "depends on. It was forwarding:\n " + |
| 453 configs[config_i].label.GetUserVisibleName(false)); |
| 453 return false; | 454 return false; |
| 454 } | 455 } |
| 455 } | 456 } |
| 456 return true; | 457 return true; |
| 457 } | 458 } |
| 458 | 459 |
| 459 std::string Builder::CheckForCircularDependencies( | 460 std::string Builder::CheckForCircularDependencies( |
| 460 const std::vector<const BuilderRecord*>& bad_records) const { | 461 const std::vector<const BuilderRecord*>& bad_records) const { |
| 461 std::vector<const BuilderRecord*> cycle; | 462 std::vector<const BuilderRecord*> cycle; |
| 462 if (!RecursiveFindCycle(bad_records[0], &cycle)) | 463 if (!RecursiveFindCycle(bad_records[0], &cycle)) |
| 463 return std::string(); // Didn't find a cycle, something else is wrong. | 464 return std::string(); // Didn't find a cycle, something else is wrong. |
| 464 | 465 |
| 465 // Walk backwards since the dependency arrows point in the reverse direction. | 466 // Walk backwards since the dependency arrows point in the reverse direction. |
| 466 std::string ret; | 467 std::string ret; |
| 467 for (int i = static_cast<int>(cycle.size()) - 1; i >= 0; i--) { | 468 for (int i = static_cast<int>(cycle.size()) - 1; i >= 0; i--) { |
| 468 ret += " " + cycle[i]->label().GetUserVisibleName(false); | 469 ret += " " + cycle[i]->label().GetUserVisibleName(false); |
| 469 if (i != 0) | 470 if (i != 0) |
| 470 ret += " ->\n"; | 471 ret += " ->\n"; |
| 471 } | 472 } |
| 472 | 473 |
| 473 return ret; | 474 return ret; |
| 474 } | 475 } |
| OLD | NEW |