diff --git a/DEPS b/DEPS index 99016225f3cfa..3835a64a798c9 100644 --- a/DEPS +++ b/DEPS @@ -34,7 +34,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': 'ce76503f5b461590926ba619351518d593b81153', + 'dart_revision': 'dcd5a8f005a27361f351ef12b2ad49e700d36169', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 127b1daddfa8e..980b804ed6854 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: e4f965835a37a079ac9033d7fe951bb4 +Signature: 32a07d90ab604d3cd5828941c268ea0d UNUSED LICENSES: diff --git a/tools/const_finder/.dart_tool/package_config.json b/tools/const_finder/.dart_tool/package_config.json index 233658b0f9bf4..73dd8bcc66263 100644 --- a/tools/const_finder/.dart_tool/package_config.json +++ b/tools/const_finder/.dart_tool/package_config.json @@ -7,6 +7,12 @@ "packageUri": "lib", "languageVersion": "2.4" }, + { + "name": "collection", + "rootUri": "../../../../third_party/dart/third_party/pkg/collection", + "packageUri": "lib", + "languageVersion": "2.10" + }, { "name": "kernel", "rootUri": "../../../../third_party/dart/pkg/kernel", @@ -32,4 +38,4 @@ "languageVersion": "2.10" } ] -} \ No newline at end of file +} diff --git a/tools/const_finder/.packages b/tools/const_finder/.packages index 68fe4139fef73..3ce2ffee720f6 100644 --- a/tools/const_finder/.packages +++ b/tools/const_finder/.packages @@ -1,5 +1,6 @@ -# Generated by pub on 2020-07-16 10:06:29.401548. +# Generated by pub on 2020-11-27 10:12:47.813477. args:../../../third_party/dart/third_party/pkg/args/lib/ +collection:../../../third_party/dart/third_party/pkg/collection/lib/ kernel:../../../third_party/dart/pkg/kernel/lib/ meta:../../../third_party/dart/pkg/meta/lib/ path:../../../third_party/dart/third_party/pkg/path/lib/ diff --git a/tools/const_finder/pubspec.yaml b/tools/const_finder/pubspec.yaml index 6411e1ef98992..cebd28c854bec 100644 --- a/tools/const_finder/pubspec.yaml +++ b/tools/const_finder/pubspec.yaml @@ -18,6 +18,7 @@ environment: dependencies: args: any + collection: any meta: any kernel: any @@ -27,6 +28,8 @@ dev_dependencies: dependency_overrides: args: path: ../../../third_party/dart/third_party/pkg/args + collection: + path: ../../../third_party/dart/third_party/pkg/collection kernel: path: ../../../third_party/dart/pkg/kernel meta: diff --git a/tools/const_finder/test/const_finder_test.dart b/tools/const_finder/test/const_finder_test.dart index 62449421a3a56..86bf55aa76d1e 100644 --- a/tools/const_finder/test/const_finder_test.dart +++ b/tools/const_finder/test/const_finder_test.dart @@ -5,6 +5,7 @@ import 'dart:convert' show jsonEncode; import 'dart:io'; +import 'package:collection/collection.dart'; import 'package:const_finder/const_finder.dart'; import 'package:path/path.dart' as path; @@ -16,6 +17,22 @@ void expect(T value, T expected) { } } +void expectInstances(dynamic value, dynamic expected) { + // To ensure we ignore insertion order into maps as well as lists we use + // DeepCollectionEquality as well as sort the lists. + + int compareByStringValue(dynamic a, dynamic b) { + return a['stringValue'].compareTo(b['stringValue']) as int; + } + value['constantInstances'].sort(compareByStringValue); + expected['constantInstances'].sort(compareByStringValue); + if (!const DeepCollectionEquality().equals(value, expected)) { + stderr.writeln('Expected: ${jsonEncode(expected)}'); + stderr.writeln('Actual: ${jsonEncode(value)}'); + exitCode = -1; + } +} + final String basePath = path.canonicalize(path.join(path.dirname(Platform.script.path), '..')); final String fixtures = path.join(basePath, 'test', 'fixtures'); @@ -50,9 +67,9 @@ void _checkConsts() { classLibraryUri: 'package:const_finder_fixtures/target.dart', className: 'Target', ); - expect( - jsonEncode(finder.findInstances()), - jsonEncode({ + expectInstances( + finder.findInstances(), + { 'constantInstances': >[ {'stringValue': '100', 'intValue': 100, 'targetValue': null}, {'stringValue': '102', 'intValue': 102, 'targetValue': null}, @@ -76,7 +93,7 @@ void _checkConsts() { {'stringValue': 'package', 'intValue':-1, 'targetValue': null}, ], 'nonConstantLocations': [], - }), + }, ); final ConstFinder finder2 = ConstFinder( @@ -84,14 +101,14 @@ void _checkConsts() { classLibraryUri: 'package:const_finder_fixtures/target.dart', className: 'MixedInTarget', ); - expect( - jsonEncode(finder2.findInstances()), - jsonEncode({ + expectInstances( + finder2.findInstances(), + { 'constantInstances': >[ {'val': '13'}, ], 'nonConstantLocations': [], - }), + }, ); } @@ -103,9 +120,9 @@ void _checkNonConsts() { className: 'Target', ); - expect( - jsonEncode(finder.findInstances()), - jsonEncode({ + expectInstances( + finder.findInstances(), + { 'constantInstances': [ {'stringValue': '1', 'intValue': 1, 'targetValue': null}, {'stringValue': '6', 'intValue': 6, 'targetValue': null}, @@ -141,7 +158,7 @@ void _checkNonConsts() { 'column': 25, } ] - }), + }, ); }