diff --git a/testing/symbols/pubspec.yaml b/testing/symbols/pubspec.yaml index cfea098886fd4680494cfd961d850643b17a926d..a45a4a0b79afb52273eb597f19541257bd5f3452 100644 --- a/testing/symbols/pubspec.yaml +++ b/testing/symbols/pubspec.yaml @@ -1,3 +1,4 @@ name: verify_exported dependencies: path: 1.6.2 + collection: 1.14.11 diff --git a/testing/symbols/verify_exported.dart b/testing/symbols/verify_exported.dart index e2c61e0ba12675f71e91d220b6157b006545a6d1..95a9982b0f3e6fc02768731a20ec31660d1901ab 100644 --- a/testing/symbols/verify_exported.dart +++ b/testing/symbols/verify_exported.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:path/path.dart' as p; +import 'package:collection/collection.dart' show MapEquality; // This script verifies that the release binaries only export the expected // symbols. @@ -92,16 +93,19 @@ int _checkAndroid(String outPath, String nmPath, Iterable builds) { continue; } final Iterable entries = NmEntry.parse(nmResult.stdout); - if (entries.isEmpty) { - print('ERROR: $libFlutter exports no symbol'); - print(' Expected exactly one symbol "JNI_OnLoad" of type "T", but got none.'); - failures++; - } else if (entries.length > 1 || entries.first.type != 'T' || entries.first.name != 'JNI_OnLoad') { - print('ERROR: $libFlutter exports unexpected symbols.'); - print(' Expected exactly one symbol "JNI_OnLoad" of type "T", but got instead:'); - print(entries.fold('', (String previous, NmEntry entry) { - return '${previous == '' ? '' : '$previous\n'} ${entry.type} ${entry.name}'; - })); + final Map entryMap = Map.fromIterable( + entries, + key: (entry) => entry.name, + value: (entry) => entry.type); + final Map expectedSymbols = { + 'JNI_OnLoad': 'T', + '_binary_icudtl_dat_size': 'A', + '_binary_icudtl_dat_start': 'D', + }; + if (!MapEquality().equals(entryMap, expectedSymbols)) { + print('ERROR: $libFlutter exports the wrong symbols'); + print(' Expected $expectedSymbols'); + print(' Library has $entryMap.'); failures++; } else { print('OK: $libFlutter');