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

[flutter_plugin_tools] Overhaul drive-examples #4099

Merged

Conversation

stuartmorgan-g
Copy link
Contributor

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

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff was a bit hard to parse, but it looks like all the old tests are still intact, just refactored.

printError('No Android devices available');
throw ToolExit(_exitNoAvailableDevice);
}
androidDevice = devices.first;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we warn if there are more than one device?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about adding more control over devices via flags, but I figured that absent anyone actually wanting that functionality I'd just do the simplest thing for now, and we can expand later (e.g., adding device choice flags to the command itself) if needed.

return errors;
}

Future<List<String>> _getDevicesForPlatform(String platform) async {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Splitting this into parsing the results of devices and calling devices would make it more testable. (Although it looks like you can use MockProcess to test it fine.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now relying on the indirect testing is fine; if we end up needing this in more places and pull this out as a utility method we can split it apart and do direct unit testing.

@stuartmorgan-g stuartmorgan-g added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Jun 30, 2021
@stuartmorgan-g
Copy link
Contributor Author

Landing on "red" since submit-queue isn't updating correctly.

@stuartmorgan-g stuartmorgan-g merged commit c36c007 into flutter:master Jun 30, 2021
@stuartmorgan-g stuartmorgan-g deleted the tool-package-looper-drive-examples branch June 30, 2021 19:16
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 30, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 1, 2021
amantoux pushed a commit to amantoux/plugins that referenced this pull request Jul 10, 2021
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
fotiDim pushed a commit to fotiDim/plugins that referenced this pull request Sep 13, 2021
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drive-examples handling of mobile is fragile
2 participants