Skip to content

Commit

Permalink
[linter] Handle linter migration in generate_package_config.dart
Browse files Browse the repository at this point in the history
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: dart-lang/linter#4411
Change-Id: I0653562a8af09a06582bbf17a44766fa64e2881f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321722
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
  • Loading branch information
whesse authored and Commit Queue committed Aug 23, 2023
1 parent 84ff6dd commit 6e77184
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/generate_package_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,16 @@ void main(List<String> 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) {
Expand Down

0 comments on commit 6e77184

Please sign in to comment.