Skip to content

Commit

Permalink
Update the verify_exported script to include the symbols for ICU data (
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored and GaryQian committed Jan 30, 2019
1 parent b032bbd commit e7eb1c8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions testing/symbols/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: verify_exported
dependencies:
path: 1.6.2
collection: 1.14.11
24 changes: 14 additions & 10 deletions testing/symbols/verify_exported.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -92,16 +93,19 @@ int _checkAndroid(String outPath, String nmPath, Iterable<String> builds) {
continue;
}
final Iterable<NmEntry> 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>('', (String previous, NmEntry entry) {
return '${previous == '' ? '' : '$previous\n'} ${entry.type} ${entry.name}';
}));
final Map<String, String> entryMap = Map.fromIterable(
entries,
key: (entry) => entry.name,
value: (entry) => entry.type);
final Map<String, String> expectedSymbols = {
'JNI_OnLoad': 'T',
'_binary_icudtl_dat_size': 'A',
'_binary_icudtl_dat_start': 'D',
};
if (!MapEquality<String, String>().equals(entryMap, expectedSymbols)) {
print('ERROR: $libFlutter exports the wrong symbols');
print(' Expected $expectedSymbols');
print(' Library has $entryMap.');
failures++;
} else {
print('OK: $libFlutter');
Expand Down

0 comments on commit e7eb1c8

Please sign in to comment.