From 6e77184d71b1d3a8b747490fe4150280dda5891a Mon Sep 17 00:00:00 2001 From: William Hesse Date: Wed, 23 Aug 2023 11:47:19 +0000 Subject: [PATCH] [linter] Handle linter migration in generate_package_config.dart The linter repository is moving into the SDK repo, moving from third_party/pkg/linter to pkg/linter. Make generate_package_config.dart compatible with a non-breaking migration, that adds the package in the new location, changes Flutter and Dart to use the new location, then removes the copy from the old location. Bug: https://github.com/dart-lang/linter/issues/4411 Change-Id: I0653562a8af09a06582bbf17a44766fa64e2881f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321722 Reviewed-by: Alexander Thomas Commit-Queue: William Hesse --- tools/generate_package_config.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart index c7bb2042656..ffe5323f8e8 100644 --- a/tools/generate_package_config.dart +++ b/tools/generate_package_config.dart @@ -82,7 +82,16 @@ void main(List args) { var hasDuplicatePackages = false; for (var name in uniqueNames) { - var matches = packages.where((p) => p.name == name).toList(); + var matches = [ + for (final p in packages) + if (p.name == name) p + ]; + if (name == 'linter' && matches.length > 1) { + final oldLinter = matches + .firstWhere((p) => p.rootUri.endsWith('third_party/pkg/linter')); + packages.remove(oldLinter); + matches.remove(oldLinter); + } if (matches.length > 1) { print('Duplicates found for package:$name'); for (var package in matches) {