Shake widget inspector from non-debug builds (#80157)

This commit is contained in:
Dan Field
2021-04-14 21:54:03 -07:00
committed by GitHub
parent b52eebb8d4
commit e7b7ebc066
37 changed files with 316 additions and 69 deletions

View File

@@ -28,7 +28,7 @@ dependencies:
file: 6.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
glob: 2.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
http: 0.13.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
http_multi_server: 3.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
http_multi_server: 3.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
io: 1.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
js: 0.6.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
logging: 1.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
@@ -61,4 +61,4 @@ dependencies:
dev_dependencies:
test_api: 0.3.0
# PUBSPEC CHECKSUM: a88d
# PUBSPEC CHECKSUM: 668e

View File

@@ -306,11 +306,62 @@ Future<void> _runToolTests() async {
});
}
Future<void> runForbiddenFromReleaseTests() async {
// Build a release APK to get the snapshot json.
final Directory tempDirectory = Directory.systemTemp.createTempSync('forbidden_imports');
final List<String> command = <String>[
'build',
'apk',
'--target-platform',
'android-arm64',
'--release',
'--analyze-size',
'--code-size-directory',
tempDirectory.path,
'-v',
];
await runCommand(
flutter,
command,
workingDirectory: path.join(flutterRoot, 'examples', 'hello_world'),
);
// First, a smoke test.
final List<String> smokeTestArgs = <String>[
path.join(flutterRoot, 'dev', 'forbidden_from_release_tests', 'bin', 'main.dart'),
'--snapshot', path.join(tempDirectory.path, 'snapshot.arm64-v8a.json'),
'--package-config', path.join(flutterRoot, 'examples', 'hello_world', '.dart_tool', 'package_config.json'),
'--forbidden-type', 'package:flutter/src/widgets/framework.dart::Widget',
];
await runCommand(
dart,
smokeTestArgs,
workingDirectory: flutterRoot,
expectNonZeroExit: true,
);
// Actual test.
final List<String> args = <String>[
path.join(flutterRoot, 'dev', 'forbidden_from_release_tests', 'bin', 'main.dart'),
'--snapshot', path.join(tempDirectory.path, 'snapshot.arm64-v8a.json'),
'--package-config', path.join(flutterRoot, 'examples', 'hello_world', '.dart_tool', 'package_config.json'),
'--forbidden-type', 'package:flutter/src/widgets/widget_inspector.dart::WidgetInspectorService',
];
await runCommand(
dart,
args,
workingDirectory: flutterRoot,
);
}
/// Verifies that APK, and IPA (if on macOS) builds the examples apps
/// without crashing. It does not actually launch the apps. That happens later
/// in the devicelab. This is just a smoke-test. In particular, this will verify
/// we can build when there are spaces in the path name for the Flutter SDK and
/// target app.
///
/// Also does some checking about types included in hello_world.
Future<void> _runBuildTests() async {
final List<FileSystemEntity> exampleDirectories = Directory(path.join(flutterRoot, 'examples')).listSync()
..add(Directory(path.join(flutterRoot, 'packages', 'integration_test', 'example')))
@@ -340,6 +391,7 @@ Future<void> _runBuildTests() async {
path.join('lib', 'dart_io_import.dart'),
),
],
runForbiddenFromReleaseTests,
]..shuffle(math.Random(0));
await _runShardRunnerIndexOfTotalSubshard(tests);