Prevent bots/analyze.dart crashing on circular dependencies (#123802)

Prevent bots/analyze.dart crashing on circular dependencies
This commit is contained in:
Danny Tuppeny 2023-03-30 22:01:06 +01:00 committed by GitHub
parent 587b9fc448
commit d163620f1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1772,7 +1772,14 @@ Future<void> _checkConsumerDependencies() async {
final List<String> currentDependencies = (currentPackage['dependencies']! as List<Object?>).cast<String>();
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]!);
}
}
}
}