Unverified Commit 66fd0b28 authored by gaaclarke's avatar gaaclarke Committed by GitHub

replaced unawaited with synchronous / await calls where needed (#82839)

parent 7f15662f
...@@ -8,7 +8,6 @@ import 'dart:convert'; ...@@ -8,7 +8,6 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:args/args.dart'; import 'package:args/args.dart';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/ab.dart'; import 'package:flutter_devicelab/framework/ab.dart';
import 'package:flutter_devicelab/framework/manifest.dart'; import 'package:flutter_devicelab/framework/manifest.dart';
import 'package:flutter_devicelab/framework/runner.dart'; import 'package:flutter_devicelab/framework/runner.dart';
...@@ -186,7 +185,7 @@ Future<void> _runABTest() async { ...@@ -186,7 +185,7 @@ Future<void> _runABTest() async {
abTest.finalize(); abTest.finalize();
final File jsonFile = _uniqueFile(args['ab-result-file'] as String ?? 'ABresults#.json'); final File jsonFile = _uniqueFile(args['ab-result-file'] as String ?? 'ABresults#.json');
unawaited(jsonFile.writeAsString(const JsonEncoder.withIndent(' ').convert(abTest.jsonMap))); jsonFile.writeAsStringSync(const JsonEncoder.withIndent(' ').convert(abTest.jsonMap));
if (!silent) { if (!silent) {
section('Raw results'); section('Raw results');
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/devices.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -109,5 +108,5 @@ Future<TaskResult> _doTest() async { ...@@ -109,5 +108,5 @@ Future<TaskResult> _doTest() async {
} }
Future<void> main() async { Future<void> main() async {
unawaited(task(_doTest)); await task(_doTest);
} }
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/apk_utils.dart'; import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -18,7 +17,7 @@ Future<void> main() async { ...@@ -18,7 +17,7 @@ Future<void> main() async {
try { try {
await runProjectTest((FlutterProject flutterProject) async { await runProjectTest((FlutterProject flutterProject) async {
section('APK contains plugin classes'); section('APK contains plugin classes');
unawaited(flutterProject.addPlugin('google_maps_flutter', value: '^1.0.10')); flutterProject.addPlugin('google_maps_flutter', value: '^1.0.10');
await inDirectory(flutterProject.rootPath, () async { await inDirectory(flutterProject.rootPath, () async {
await flutter('build', options: <String>[ await flutter('build', options: <String>[
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/apk_utils.dart'; import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -220,8 +219,8 @@ Future<void> main() async { ...@@ -220,8 +219,8 @@ Future<void> main() async {
}); });
section('Configure'); section('Configure');
unawaited(project.addPlugin('plugin_under_test', project.addPlugin('plugin_under_test',
value: '$platformLineSep path: ${pluginDir.path}')); value: '$platformLineSep path: ${pluginDir.path}');
await project.addCustomBuildType('local', initWith: 'debug'); await project.addCustomBuildType('local', initWith: 'debug');
await project.getPackages(); await project.getPackages();
...@@ -240,7 +239,7 @@ Future<void> main() async { ...@@ -240,7 +239,7 @@ Future<void> main() async {
await project.addCustomBuildType('local', initWith: 'debug'); await project.addCustomBuildType('local', initWith: 'debug');
await project.addGlobalBuildType('local', initWith: 'debug'); await project.addGlobalBuildType('local', initWith: 'debug');
section('Add plugin'); section('Add plugin');
await project.addPlugin('path_provider'); project.addPlugin('path_provider');
await project.getPackages(); await project.getPackages();
await project.runGradleTask('assembleLocal'); await project.runGradleTask('assembleLocal');
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter_devicelab/common.dart';
import 'package:flutter_devicelab/framework/apk_utils.dart'; import 'package:flutter_devicelab/framework/apk_utils.dart';
import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/task_result.dart';
...@@ -56,7 +55,8 @@ Future<void> main() async { ...@@ -56,7 +55,8 @@ Future<void> main() async {
'Flutter', 'Flutter',
); );
// Exits 0 only if codesigned. // Exits 0 only if codesigned.
unawaited(eval('xcrun', <String>['codesign', '--verify', flutterFramework])); final Future<String> flutterCodesign =
eval('xcrun', <String>['codesign', '--verify', flutterFramework]);
final String appFramework = path.join( final String appFramework = path.join(
appBundle.path, appBundle.path,
...@@ -64,7 +64,10 @@ Future<void> main() async { ...@@ -64,7 +64,10 @@ Future<void> main() async {
'App.framework', 'App.framework',
'App', 'App',
); );
unawaited(eval('xcrun', <String>['codesign', '--verify', appFramework])); final Future<String> appCodesign =
eval('xcrun', <String>['codesign', '--verify', appFramework]);
await flutterCodesign;
await appCodesign;
}); });
return TaskResult.success(null); return TaskResult.success(null);
......
...@@ -299,14 +299,14 @@ subprojects { ...@@ -299,14 +299,14 @@ subprojects {
/// Adds a plugin to the pubspec. /// Adds a plugin to the pubspec.
/// In pubspec, each dependency is expressed as key, value pair joined by a colon `:`. /// In pubspec, each dependency is expressed as key, value pair joined by a colon `:`.
/// such as `plugin_a`:`^0.0.1` or `plugin_a`:`\npath: /some/path`. /// such as `plugin_a`:`^0.0.1` or `plugin_a`:`\npath: /some/path`.
Future<void> addPlugin(String plugin, { String value = '' }) async { void addPlugin(String plugin, { String value = '' }) {
final File pubspec = File(path.join(rootPath, 'pubspec.yaml')); final File pubspec = File(path.join(rootPath, 'pubspec.yaml'));
String content = await pubspec.readAsString(); String content = pubspec.readAsStringSync();
content = content.replaceFirst( content = content.replaceFirst(
'${platformLineSep}dependencies:$platformLineSep', '${platformLineSep}dependencies:$platformLineSep',
'${platformLineSep}dependencies:$platformLineSep $plugin: $value$platformLineSep', '${platformLineSep}dependencies:$platformLineSep $plugin: $value$platformLineSep',
); );
await pubspec.writeAsString(content, flush: true); pubspec.writeAsStringSync(content, flush: true);
} }
Future<void> getPackages() async { Future<void> getPackages() async {
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
import 'dart:io'; import 'dart:io';
import 'package:args/args.dart'; import 'package:args/args.dart';
import 'package:flutter_devicelab/common.dart';
import '../framework/devices.dart'; import '../framework/devices.dart';
import '../framework/task_result.dart'; import '../framework/task_result.dart';
...@@ -109,7 +108,7 @@ abstract class BuildTestTask { ...@@ -109,7 +108,7 @@ abstract class BuildTestTask {
} }
if (!testOnly) { if (!testOnly) {
unawaited(build()); await build();
} }
if (buildOnly) { if (buildOnly) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment