From d163620f1f0cbcf041ccf971ac759c9ecc287b33 Mon Sep 17 00:00:00 2001 From: Danny Tuppeny Date: Thu, 30 Mar 2023 22:01:06 +0100 Subject: [PATCH] Prevent bots/analyze.dart crashing on circular dependencies (#123802) Prevent bots/analyze.dart crashing on circular dependencies --- dev/bots/analyze.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dev/bots/analyze.dart b/dev/bots/analyze.dart index a09ba787d1..0e64a032d1 100644 --- a/dev/bots/analyze.dart +++ b/dev/bots/analyze.dart @@ -1772,7 +1772,14 @@ Future _checkConsumerDependencies() async { final List currentDependencies = (currentPackage['dependencies']! as List).cast(); for (final String dependency in currentDependencies) { - workset.add(dependencyTree[dependency]!); + // Don't add dependencies we've already seen or we will get stuck + // forever if there are any circular references. + // TODO(dantup): Consider failing gracefully with the names of the + // packages once the cycle between test_api and matcher is resolved. + // https://github.com/dart-lang/test/issues/1979 + if (!dependencies.contains(dependency)) { + workset.add(dependencyTree[dependency]!); + } } } }