Skip to content

Commit

Permalink
Use path dependencies for testing/symbols (flutter#26261)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanderso authored May 20, 2021
1 parent 22a913c commit 328f92d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
6 changes: 6 additions & 0 deletions ci/analyze.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 20 additions & 2 deletions testing/symbols/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 12 additions & 13 deletions testing/symbols/verify_exported.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -43,7 +42,7 @@ void main(List<String> arguments) {
assert(Directory(outPath).existsSync());

final Iterable<String> releaseBuilds = Directory(outPath).listSync()
.where((FileSystemEntity entity) => entity is Directory)
.whereType<Directory>()
.map<String>((FileSystemEntity dir) => p.basename(dir.path))
.where((String s) => s.contains('_release'));

Expand All @@ -61,7 +60,7 @@ void main(List<String> arguments) {

int _checkIos(String outPath, String nmPath, Iterable<String> 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.');
Expand All @@ -73,10 +72,10 @@ int _checkIos(String outPath, String nmPath, Iterable<String> builds) {
failures++;
continue;
}
final Iterable<NmEntry> unexpectedEntries = NmEntry.parse(nmResult.stdout).where((NmEntry entry) {
final Iterable<NmEntry> 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:');
Expand All @@ -93,7 +92,7 @@ int _checkIos(String outPath, String nmPath, Iterable<String> builds) {

int _checkAndroid(String outPath, String nmPath, Iterable<String> 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.');
Expand All @@ -105,17 +104,17 @@ int _checkAndroid(String outPath, String nmPath, Iterable<String> builds) {
failures++;
continue;
}
final Iterable<NmEntry> entries = NmEntry.parse(nmResult.stdout);
final Map<String, String> entryMap = Map<String, String>.fromIterable(
entries,
key: (dynamic entry) => entry.name,
value: (dynamic entry) => entry.type);
final Iterable<NmEntry> entries = NmEntry.parse(nmResult.stdout as String);
final Map<String, String> entryMap = <String, String>{
for (final NmEntry entry in entries)
entry.name: entry.type,
};
final Map<String, String> expectedSymbols = <String, String>{
'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',
Expand Down
1 change: 1 addition & 0 deletions tools/pub_get_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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"),
Expand Down

0 comments on commit 328f92d

Please sign in to comment.