Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit c36c007

Browse files
[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 flutter/flutter#85147 Part of flutter/flutter#83413
1 parent 44f3d5d commit c36c007

File tree

4 files changed

+692
-306
lines changed

4 files changed

+692
-306
lines changed

script/tool/lib/src/build_examples_command.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'dart:async';
66

77
import 'package:file/file.dart';
88
import 'package:path/path.dart' as p;
9-
import 'package:platform/platform.dart';
109

1110
import 'common/core.dart';
1211
import 'common/package_looping_command.dart';
@@ -151,8 +150,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
151150
String flutterBuildType, {
152151
List<String> extraBuildFlags = const <String>[],
153152
}) async {
154-
final String flutterCommand =
155-
const LocalPlatform().isWindows ? 'flutter.bat' : 'flutter';
156153
final String enableExperiment = getStringArg(kEnableExperiment);
157154

158155
final int exitCode = await processRunner.runAndStream(

script/tool/lib/src/common/plugin_command.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:args/command_runner.dart';
88
import 'package:file/file.dart';
99
import 'package:git/git.dart';
1010
import 'package:path/path.dart' as p;
11+
import 'package:platform/platform.dart';
1112

1213
import 'core.dart';
1314
import 'git_version_finder.dart';
@@ -85,6 +86,10 @@ abstract class PluginCommand extends Command<void> {
8586
int? _shardIndex;
8687
int? _shardCount;
8788

89+
/// The command to use when running `flutter`.
90+
String get flutterCommand =>
91+
const LocalPlatform().isWindows ? 'flutter.bat' : 'flutter';
92+
8893
/// The shard of the overall command execution that this instance should run.
8994
int get shardIndex {
9095
if (_shardIndex == null) {

0 commit comments

Comments
 (0)