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

[flutter_plugin_tools] Migrate 'test' to new base command #4133

Merged
merged 5 commits into from Jul 7, 2021

Conversation

stuartmorgan
Copy link
Contributor

Migrates test to the new package looping base command.

Refactors the bulk of the logic to helpers for easier understanding of the flow.

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.

@stuartmorgan stuartmorgan requested a review from ditman July 2, 2021 16:46
@google-cla google-cla bot added the cla: yes label Jul 2, 2021
@stuartmorgan
Copy link
Contributor Author

This is probably the simplest command we have, and it hadn't been migrated, so that works out well as an intro to these refactors :) I think the only context you'll need here is to look at https://github.com/flutter/plugins/blob/master/script/tool/lib/src/common/package_looping_command.dart

Note that this is divided into two commits: the first is just a simple local refactor to pull the bulk of the logic into helpers and do some minor cleanup on them (e.g., using if in lists instead of the older method of conditional add calls in more places). The second is the migration itself, and should be very simple to follow given the first commit (I originally did them the other way, but the diffs weren't very good due to the whitespace changes + cleanup).

Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

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

This is a great refactor. The code is wwwway simpler to follow now!

script/tool/lib/src/test_command.dart Show resolved Hide resolved
// packages
int exitCode = await processRunner.runAndStream(
'dart',
<String>['pub', 'get'],
Copy link
Member

Choose a reason for hiding this comment

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

(Isn't it slightly odd that flutter tests don't attempt to flutter pub get too?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the comment just above this line.

script/tool/lib/src/test_command.dart Show resolved Hide resolved

print('RUNNING $packageName tests...');
Copy link
Member

Choose a reason for hiding this comment

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

There's a lot of missing "reporting". Is that done by the PackageLoopingCommand now? (not that I'm going to miss it, just making sure that the output log stays useful)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Standardized output for starting each package's run is part of the base command, yes.

@stuartmorgan stuartmorgan merged commit b16697c into flutter:master Jul 7, 2021
@stuartmorgan stuartmorgan deleted the tool-package-looper-test branch July 7, 2021 15:32
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 7, 2021
amantoux pushed a commit to amantoux/plugins that referenced this pull request Jul 10, 2021
Migrates `test` to the new package looping base command.

Refactors the bulk of the logic to helpers for easier understanding of the flow.

Part of flutter/flutter#83413
fotiDim pushed a commit to fotiDim/plugins that referenced this pull request Sep 13, 2021
Migrates `test` to the new package looping base command.

Refactors the bulk of the logic to helpers for easier understanding of the flow.

Part of flutter/flutter#83413
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants