[flutter_plugin_tools] Add 'main' support (#4474)

Treat `main` the same as `master` for branch-based switching, in
preparation for switching the branch names in Flutter repositories.

Also updates all of the tests that used `master` as the explicit base to
use `main` instead; what the tests use is arbitrary, so they can be
switched now even though the repo itself hasn't switched.

Part of https://github.com/flutter/flutter/issues/90476
This commit is contained in:
stuartmorgan
2021-11-10 14:46:35 -05:00
committed by GitHub
parent 78395e5adf
commit 5d15fe9626
9 changed files with 122 additions and 148 deletions

View File

@ -81,7 +81,8 @@ abstract class PluginCommand extends Command<void> {
argParser.addFlag(_packagesForBranchArg,
help:
'This runs on all packages (equivalent to no package selection flag)\n'
'on master, and behaves like --run-on-changed-packages on any other branch.\n\n'
'on main (or master), and behaves like --run-on-changed-packages on '
'any other branch.\n\n'
'Cannot be combined with $_packagesArg.\n\n'
'This is intended for use in CI.\n',
hide: true);
@ -301,7 +302,7 @@ abstract class PluginCommand extends Command<void> {
'only be used in a git repository.');
throw ToolExit(exitInvalidArguments);
} else {
runOnChangedPackages = branch != 'master';
runOnChangedPackages = branch != 'master' && branch != 'main';
// Log the mode for auditing what was intended to run.
print('--$_packagesForBranchArg: running on '
'${runOnChangedPackages ? 'changed' : 'all'} packages');