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

Commit

Permalink
[flutter_plugin_tools] Overhaul drive-examples (#4099)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stuartmorgan committed Jun 30, 2021
1 parent 44f3d5d commit c36c007
Show file tree
Hide file tree
Showing 4 changed files with 692 additions and 306 deletions.
3 changes: 0 additions & 3 deletions script/tool/lib/src/build_examples_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'dart:async';

import 'package:file/file.dart';
import 'package:path/path.dart' as p;
import 'package:platform/platform.dart';

import 'common/core.dart';
import 'common/package_looping_command.dart';
Expand Down Expand Up @@ -151,8 +150,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
String flutterBuildType, {
List<String> extraBuildFlags = const <String>[],
}) async {
final String flutterCommand =
const LocalPlatform().isWindows ? 'flutter.bat' : 'flutter';
final String enableExperiment = getStringArg(kEnableExperiment);

final int exitCode = await processRunner.runAndStream(
Expand Down
5 changes: 5 additions & 0 deletions script/tool/lib/src/common/plugin_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit c36c007

Please sign in to comment.