flutter/dev/devicelab/lib/tasks/platform_channels_benchmarks.dart
Michael Goderbauer 5491c8c146
Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the
`engine` subdirectory and enforces that these files stay formatted with
a presubmit check.

**Reviewers:** Please carefully review all the commits except for the
one titled "formatted". The "formatted" commit was auto-generated by
running `dev/tools/format.sh -a -f`. The other commits were hand-crafted
to prepare the repo for the formatting change. I recommend reviewing the
commits one-by-one via the "Commits" tab and avoiding Github's "Files
changed" tab as it will likely slow down your browser because of the
size of this PR.

---------

Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
2024-12-19 20:06:21 +00:00

50 lines
1.7 KiB
Dart

// Copyright 2014 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.
import 'dart:io' show Directory, Process;
import 'package:path/path.dart' as path;
import '../framework/devices.dart' as adb;
import '../framework/framework.dart' show TaskFunction;
import '../framework/task_result.dart' show TaskResult;
import '../framework/utils.dart' as utils;
import '../microbenchmarks.dart' as microbenchmarks;
TaskFunction runTask(adb.DeviceOperatingSystem operatingSystem) {
return () async {
adb.deviceOperatingSystem = operatingSystem;
final adb.Device device = await adb.devices.workingDevice;
await device.unlock();
final Directory appDir = utils.dir(
path.join(utils.flutterDirectory.path, 'dev/benchmarks/platform_channels_benchmarks'),
);
final Process flutterProcess = await utils.inDirectory(appDir, () async {
final List<String> createArgs = <String>[
'--platforms',
'ios,android',
'--no-overwrite',
'-v',
'.',
];
print('\nExecuting: flutter create $createArgs $appDir');
await utils.flutter('create', options: createArgs);
final List<String> options = <String>[
'-v',
// --release doesn't work on iOS due to code signing issues
'--profile',
'--no-publish-port',
'-d',
device.deviceId,
];
return utils.startFlutter('run', options: options);
});
final Map<String, double> results = await microbenchmarks.readJsonResults(flutterProcess);
return TaskResult.success(results, benchmarkScoreKeys: results.keys.toList());
};
}