diff --git a/engine/src/flutter/ci/analyze.sh b/engine/src/flutter/ci/analyze.sh index c71ffed0af..65b277fe8a 100755 --- a/engine/src/flutter/ci/analyze.sh +++ b/engine/src/flutter/ci/analyze.sh @@ -104,6 +104,12 @@ analyze \ --options "$FLUTTER_DIR/analysis_options.yaml" \ "$FLUTTER_DIR/testing/scenario_app" +echo "Analyzing testing/symbols..." +analyze \ + --packages="$FLUTTER_DIR/testing/symbols/.dart_tool/package_config.json" \ + --options "$FLUTTER_DIR/analysis_options.yaml" \ + "$FLUTTER_DIR/testing/symbols" + # Check that dart libraries conform. echo "Checking web_ui api conformance..." (cd "$FLUTTER_DIR/web_sdk"; pub get) diff --git a/engine/src/flutter/testing/symbols/pubspec.yaml b/engine/src/flutter/testing/symbols/pubspec.yaml index eb59cfa981..3b4a45cefc 100644 --- a/engine/src/flutter/testing/symbols/pubspec.yaml +++ b/engine/src/flutter/testing/symbols/pubspec.yaml @@ -1,6 +1,24 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + name: verify_exported +publish_to: none environment: sdk: '>=2.11.0 <3.0.0' + +# Do not add any dependencies that require more than what is provided in +# //third_party.pkg, //third_party/dart/pkg, or +# //third_party/dart/third_party/pkg. In particular, package:test is not usable +# here. + +# If you do add packages here, make sure you can run `pub get --offline`, and +# check the .packages and .package_config to make sure all the paths are +# relative to this directory into //third_party/dart + dependencies: - path: 1.6.2 - collection: 1.14.11 + path: any + +dependency_overrides: + path: + path: ../../../third_party/dart/third_party/pkg/path diff --git a/engine/src/flutter/testing/symbols/verify_exported.dart b/engine/src/flutter/testing/symbols/verify_exported.dart index e349a0503e..5aa4fae214 100644 --- a/engine/src/flutter/testing/symbols/verify_exported.dart +++ b/engine/src/flutter/testing/symbols/verify_exported.dart @@ -7,7 +7,6 @@ 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. @@ -43,7 +42,7 @@ void main(List arguments) { assert(Directory(outPath).existsSync()); final Iterable releaseBuilds = Directory(outPath).listSync() - .where((FileSystemEntity entity) => entity is Directory) + .whereType() .map((FileSystemEntity dir) => p.basename(dir.path)) .where((String s) => s.contains('_release')); @@ -61,7 +60,7 @@ void main(List arguments) { int _checkIos(String outPath, String nmPath, Iterable builds) { int failures = 0; - for (String build in builds) { + for (final String build in builds) { final String libFlutter = p.join(outPath, build, 'Flutter.framework', 'Flutter'); if (!File(libFlutter).existsSync()) { print('SKIPPING: $libFlutter does not exist.'); @@ -73,10 +72,10 @@ int _checkIos(String outPath, String nmPath, Iterable builds) { failures++; continue; } - final Iterable unexpectedEntries = NmEntry.parse(nmResult.stdout).where((NmEntry entry) { + final Iterable unexpectedEntries = NmEntry.parse(nmResult.stdout as String).where((NmEntry entry) { return !(((entry.type == '(__DATA,__common)' || entry.type == '(__DATA,__const)') && entry.name.startsWith('_Flutter')) || (entry.type == '(__DATA,__objc_data)' - && (entry.name.startsWith('_OBJC_METACLASS_\$_Flutter') || entry.name.startsWith('_OBJC_CLASS_\$_Flutter')))); + && (entry.name.startsWith(r'_OBJC_METACLASS_$_Flutter') || entry.name.startsWith(r'_OBJC_CLASS_$_Flutter')))); }); if (unexpectedEntries.isNotEmpty) { print('ERROR: $libFlutter exports unexpected symbols:'); @@ -93,7 +92,7 @@ int _checkIos(String outPath, String nmPath, Iterable builds) { int _checkAndroid(String outPath, String nmPath, Iterable builds) { int failures = 0; - for (String build in builds) { + for (final String build in builds) { final String libFlutter = p.join(outPath, build, 'libflutter.so'); if (!File(libFlutter).existsSync()) { print('SKIPPING: $libFlutter does not exist.'); @@ -105,17 +104,17 @@ int _checkAndroid(String outPath, String nmPath, Iterable builds) { failures++; continue; } - final Iterable entries = NmEntry.parse(nmResult.stdout); - final Map entryMap = Map.fromIterable( - entries, - key: (dynamic entry) => entry.name, - value: (dynamic entry) => entry.type); + final Iterable entries = NmEntry.parse(nmResult.stdout as String); + final Map entryMap = { + for (final NmEntry entry in entries) + entry.name: entry.type, + }; final Map expectedSymbols = { 'JNI_OnLoad': 'T', '_binary_icudtl_dat_size': 'A', '_binary_icudtl_dat_start': 'D', - // TODO(fxb/47943): Remove these once Clang lld does not expose them. - // arm + // TODO(dnfield): Remove these once Clang lld does not expose them. + // arm https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=47943 '__adddf3': 'T', '__addsf3': 'T', '__aeabi_cdcmpeq': 'T', diff --git a/engine/src/flutter/tools/pub_get_offline.py b/engine/src/flutter/tools/pub_get_offline.py index b6e55883b0..4e46168532 100644 --- a/engine/src/flutter/tools/pub_get_offline.py +++ b/engine/src/flutter/tools/pub_get_offline.py @@ -18,6 +18,7 @@ ALL_PACKAGES = [ os.path.join("src", "flutter", "flutter_frontend_server"), os.path.join("src", "flutter", "testing", "litetest"), os.path.join("src", "flutter", "testing", "smoke_test_failure"), + os.path.join("src", "flutter", "testing", "symbols"), os.path.join("src", "flutter", "tools", "android_lint"), os.path.join("src", "flutter", "tools", "const_finder"), os.path.join("src", "flutter", "tools", "licenses"),