[flutter_plugin_tools] Overhaul drive-examples (#4099)

Significantly restructures drive-examples:
- Migrates it to the new package-looping base command
- Enforces that only one platform is passed, since in practice multiple platforms never actually worked. (The logic is structured so that it will be easy to enable multi-platform if `flutter drive` gains multi-platform support.)
- Fixes the issue where `--ios` and `--android` were semi-broken, by doing explicit device targeting for them rather than relying on the default device being the right kind
- Extracts much of the logic to helpers so it's easier to understand the flow
- Removes support for a legacy integration test file structure that is no longer used
- Adds more test coverage; previously no failure cases were actually tested.

Fixes https://github.com/flutter/flutter/issues/85147
Part of https://github.com/flutter/flutter/issues/83413
This commit is contained in:
stuartmorgan
2021-06-30 12:16:46 -07:00
committed by GitHub
parent ec9233eb41
commit 92d6214984
4 changed files with 697 additions and 311 deletions

View File

@ -8,6 +8,7 @@ import 'package:args/command_runner.dart';
import 'package:file/file.dart';
import 'package:git/git.dart';
import 'package:path/path.dart' as p;
import 'package:platform/platform.dart';
import 'core.dart';
import 'git_version_finder.dart';
@ -85,6 +86,10 @@ abstract class PluginCommand extends Command<void> {
int? _shardIndex;
int? _shardCount;
/// The command to use when running `flutter`.
String get flutterCommand =>
const LocalPlatform().isWindows ? 'flutter.bat' : 'flutter';
/// The shard of the overall command execution that this instance should run.
int get shardIndex {
if (_shardIndex == null) {