@@ -57,10 +57,15 @@ void main(List<String> arguments) {
5757 .where ((String s) => s.startsWith ('ios_' ));
5858 final Iterable <String > androidReleaseBuilds = releaseBuilds
5959 .where ((String s) => s.startsWith ('android_' ));
60+ final Iterable <String > hostReleaseBuilds = releaseBuilds
61+ .where ((String s) => s.startsWith ('host_' ));
6062
6163 int failures = 0 ;
6264 failures += _checkIos (outPath, nmPath, iosReleaseBuilds);
6365 failures += _checkAndroid (outPath, nmPath, androidReleaseBuilds);
66+ if (Platform .isLinux) {
67+ failures += _checkLinux (outPath, nmPath, hostReleaseBuilds);
68+ }
6469 print ('Failing checks: $failures ' );
6570 exit (failures);
6671}
@@ -237,6 +242,40 @@ int _checkAndroid(String outPath, String nmPath, Iterable<String> builds) {
237242 return failures;
238243}
239244
245+ int _checkLinux (String outPath, String nmPath, Iterable <String > builds) {
246+ int failures = 0 ;
247+ for (final String build in builds) {
248+ final String libFlutter = p.join (outPath, build, 'libflutter_engine.so' );
249+ if (! File (libFlutter).existsSync ()) {
250+ print ('SKIPPING: $libFlutter does not exist.' );
251+ continue ;
252+ }
253+ final ProcessResult nmResult = Process .runSync (nmPath, < String > ['-gUD' , libFlutter]);
254+ if (nmResult.exitCode != 0 ) {
255+ print ('ERROR: failed to execute "nm -gUD $libFlutter ":\n ${nmResult .stderr }' );
256+ failures++ ;
257+ continue ;
258+ }
259+ final List <NmEntry > entries = NmEntry .parse (nmResult.stdout as String ).toList ();
260+ for (final NmEntry entry in entries) {
261+ if (entry.type != 'T' && entry.type != 'R' ) {
262+ print ('ERROR: $libFlutter exports an unexpected symbol type: ($entry )' );
263+ print (' Library has $entries .' );
264+ failures++ ;
265+ break ;
266+ }
267+ if (! (entry.name.startsWith ('Flutter' )
268+ || entry.name.startsWith ('__Flutter' ))) {
269+ print ('ERROR: $libFlutter exports an unexpected symbol name: ($entry )' );
270+ print (' Library has $entries .' );
271+ failures++ ;
272+ break ;
273+ }
274+ }
275+ }
276+ return failures;
277+ }
278+
240279class NmEntry {
241280 NmEntry ._(this .address, this .type, this .name);
242281
@@ -250,4 +289,7 @@ class NmEntry {
250289 return NmEntry ._(parts[0 ], parts[1 ], parts.last);
251290 });
252291 }
292+
293+ @override
294+ String toString () => '$name : $type ' ;
253295}
0 commit comments