[flutter_plugin_tools] Add --packages, and deprecated --plugins (#4134)

Most of the tool operates on packages in general, and the targetting
done currently by the `--plugins` flag is not actually restricted to
plugins, so this makes the name less confusing.

Part of https://github.com/flutter/flutter/issues/83413
This commit is contained in:
stuartmorgan
2021-07-04 09:26:28 -07:00
committed by GitHub
parent d2761ab1de
commit b7ff215760
5 changed files with 79 additions and 25 deletions

View File

@ -24,11 +24,12 @@ abstract class PluginCommand extends Command<void> {
GitDir? gitDir,
}) : _gitDir = gitDir {
argParser.addMultiOption(
_pluginsArg,
_packagesArg,
splitCommas: true,
help:
'Specifies which plugins the command should run on (before sharding).',
valueHelp: 'plugin1,plugin2,...',
'Specifies which packages the command should run on (before sharding).\n',
valueHelp: 'package1,package2,...',
aliases: <String>[_pluginsArg],
);
argParser.addOption(
_shardIndexArg,
@ -51,7 +52,7 @@ abstract class PluginCommand extends Command<void> {
);
argParser.addFlag(_runOnChangedPackagesArg,
help: 'Run the command on changed packages/plugins.\n'
'If the $_pluginsArg is specified, this flag is ignored.\n'
'If the $_packagesArg is specified, this flag is ignored.\n'
'If no packages have changed, or if there have been changes that may\n'
'affect all packages, the command runs on all packages.\n'
'The packages excluded with $_excludeArg is also excluded even if changed.\n'
@ -63,6 +64,7 @@ abstract class PluginCommand extends Command<void> {
}
static const String _pluginsArg = 'plugins';
static const String _packagesArg = 'packages';
static const String _shardIndexArg = 'shardIndex';
static const String _shardCountArg = 'shardCount';
static const String _excludeArg = 'exclude';
@ -203,7 +205,7 @@ abstract class PluginCommand extends Command<void> {
/// is a sibling of the packages directory. This is used for a small number
/// of packages in the flutter/packages repository.
Stream<Directory> _getAllPlugins() async* {
Set<String> plugins = Set<String>.from(getStringListArg(_pluginsArg));
Set<String> plugins = Set<String>.from(getStringListArg(_packagesArg));
final Set<String> excludedPlugins =
Set<String>.from(getStringListArg(_excludeArg));
final bool runOnChangedPackages = getBoolArg(_runOnChangedPackagesArg);