@@ -34,9 +34,9 @@ class PackageEnumerationEntry {
34
34
35
35
/// Interface definition for all commands in this tool.
36
36
// TODO(stuartmorgan): Move most of this logic to PackageLoopingCommand.
37
- abstract class PluginCommand extends Command <void > {
37
+ abstract class PackageCommand extends Command <void > {
38
38
/// Creates a command to operate on [packagesDir] with the given environment.
39
- PluginCommand (
39
+ PackageCommand (
40
40
this .packagesDir, {
41
41
this .processRunner = const ProcessRunner (),
42
42
this .platform = const LocalPlatform (),
@@ -47,7 +47,7 @@ abstract class PluginCommand extends Command<void> {
47
47
help:
48
48
'Specifies which packages the command should run on (before sharding).\n ' ,
49
49
valueHelp: 'package1,package2,...' ,
50
- aliases: < String > [_pluginsArg ],
50
+ aliases: < String > [_pluginsLegacyAliasArg ],
51
51
);
52
52
argParser.addOption (
53
53
_shardIndexArg,
@@ -58,7 +58,7 @@ abstract class PluginCommand extends Command<void> {
58
58
);
59
59
argParser.addOption (
60
60
_shardCountArg,
61
- help: 'Specifies the number of shards into which plugins are divided.' ,
61
+ help: 'Specifies the number of shards into which packages are divided.' ,
62
62
valueHelp: 'n' ,
63
63
defaultsTo: '1' ,
64
64
);
@@ -71,7 +71,7 @@ abstract class PluginCommand extends Command<void> {
71
71
defaultsTo: < String > [],
72
72
);
73
73
argParser.addFlag (_runOnChangedPackagesArg,
74
- help: 'Run the command on changed packages/plugins .\n '
74
+ help: 'Run the command on changed packages.\n '
75
75
'If no packages have changed, or if there have been changes that may\n '
76
76
'affect all packages, the command runs on all packages.\n '
77
77
'Packages excluded with $_excludeArg are excluded even if changed.\n '
@@ -106,13 +106,13 @@ abstract class PluginCommand extends Command<void> {
106
106
static const String _logTimingArg = 'log-timing' ;
107
107
static const String _packagesArg = 'packages' ;
108
108
static const String _packagesForBranchArg = 'packages-for-branch' ;
109
- static const String _pluginsArg = 'plugins' ;
109
+ static const String _pluginsLegacyAliasArg = 'plugins' ;
110
110
static const String _runOnChangedPackagesArg = 'run-on-changed-packages' ;
111
111
static const String _runOnDirtyPackagesArg = 'run-on-dirty-packages' ;
112
112
static const String _shardCountArg = 'shardCount' ;
113
113
static const String _shardIndexArg = 'shardIndex' ;
114
114
115
- /// The directory containing the plugin packages.
115
+ /// The directory containing the packages.
116
116
final Directory packagesDir;
117
117
118
118
/// The process runner.
@@ -221,7 +221,7 @@ abstract class PluginCommand extends Command<void> {
221
221
_shardCount = shardCount;
222
222
}
223
223
224
- /// Returns the set of plugins to exclude based on the `--exclude` argument.
224
+ /// Returns the set of packages to exclude based on the `--exclude` argument.
225
225
Set <String > getExcludedPackageNames () {
226
226
final Set <String > excludedPackages = _excludedPackages ??
227
227
getStringListArg (_excludeArg).expand <String >((String item) {
@@ -250,22 +250,22 @@ abstract class PluginCommand extends Command<void> {
250
250
Stream <PackageEnumerationEntry > getTargetPackages (
251
251
{bool filterExcluded = true }) async * {
252
252
// To avoid assuming consistency of `Directory.list` across command
253
- // invocations, we collect and sort the plugin folders before sharding.
253
+ // invocations, we collect and sort the package folders before sharding.
254
254
// This is considered an implementation detail which is why the API still
255
255
// uses streams.
256
- final List <PackageEnumerationEntry > allPlugins =
256
+ final List <PackageEnumerationEntry > allPackages =
257
257
await _getAllPackages ().toList ();
258
- allPlugins .sort ((PackageEnumerationEntry p1, PackageEnumerationEntry p2) =>
258
+ allPackages .sort ((PackageEnumerationEntry p1, PackageEnumerationEntry p2) =>
259
259
p1.package.path.compareTo (p2.package.path));
260
- final int shardSize = allPlugins .length ~ / shardCount +
261
- (allPlugins .length % shardCount == 0 ? 0 : 1 );
262
- final int start = min (shardIndex * shardSize, allPlugins .length);
263
- final int end = min (start + shardSize, allPlugins .length);
264
-
265
- for (final PackageEnumerationEntry plugin
266
- in allPlugins .sublist (start, end)) {
267
- if (! (filterExcluded && plugin .excluded)) {
268
- yield plugin ;
260
+ final int shardSize = allPackages .length ~ / shardCount +
261
+ (allPackages .length % shardCount == 0 ? 0 : 1 );
262
+ final int start = min (shardIndex * shardSize, allPackages .length);
263
+ final int end = min (start + shardSize, allPackages .length);
264
+
265
+ for (final PackageEnumerationEntry package
266
+ in allPackages .sublist (start, end)) {
267
+ if (! (filterExcluded && package .excluded)) {
268
+ yield package ;
269
269
}
270
270
}
271
271
}
@@ -330,7 +330,7 @@ abstract class PluginCommand extends Command<void> {
330
330
runOnChangedPackages = false ;
331
331
}
332
332
333
- final Set <String > excludedPluginNames = getExcludedPackageNames ();
333
+ final Set <String > excludedPackageNames = getExcludedPackageNames ();
334
334
335
335
if (runOnChangedPackages) {
336
336
final GitVersionFinder gitVersionFinder = await retrieveVersionFinder ();
@@ -368,15 +368,16 @@ abstract class PluginCommand extends Command<void> {
368
368
]) {
369
369
await for (final FileSystemEntity entity
370
370
in dir.list (followLinks: false )) {
371
- // A top-level Dart package is a plugin package.
371
+ // A top-level Dart package is a standard package.
372
372
if (isPackage (entity)) {
373
373
if (packages.isEmpty || packages.contains (p.basename (entity.path))) {
374
374
yield PackageEnumerationEntry (
375
375
RepositoryPackage (entity as Directory ),
376
- excluded: excludedPluginNames .contains (entity.basename));
376
+ excluded: excludedPackageNames .contains (entity.basename));
377
377
}
378
378
} else if (entity is Directory ) {
379
- // Look for Dart packages under this top-level directory.
379
+ // Look for Dart packages under this top-level directory; this is the
380
+ // standard structure for federated plugins.
380
381
await for (final FileSystemEntity subdir
381
382
in entity.list (followLinks: false )) {
382
383
if (isPackage (subdir)) {
@@ -394,7 +395,7 @@ abstract class PluginCommand extends Command<void> {
394
395
packages.intersection (possibleMatches).isNotEmpty) {
395
396
yield PackageEnumerationEntry (
396
397
RepositoryPackage (subdir as Directory ),
397
- excluded: excludedPluginNames
398
+ excluded: excludedPackageNames
398
399
.intersection (possibleMatches)
399
400
.isNotEmpty);
400
401
}
@@ -415,11 +416,12 @@ abstract class PluginCommand extends Command<void> {
415
416
/// stream.
416
417
Stream <PackageEnumerationEntry > getTargetPackagesAndSubpackages (
417
418
{bool filterExcluded = true }) async * {
418
- await for (final PackageEnumerationEntry plugin
419
+ await for (final PackageEnumerationEntry package
419
420
in getTargetPackages (filterExcluded: filterExcluded)) {
420
- yield plugin;
421
- yield * getSubpackages (plugin.package).map ((RepositoryPackage package) =>
422
- PackageEnumerationEntry (package, excluded: plugin.excluded));
421
+ yield package;
422
+ yield * getSubpackages (package.package).map (
423
+ (RepositoryPackage subPackage) =>
424
+ PackageEnumerationEntry (subPackage, excluded: package.excluded));
423
425
}
424
426
}
425
427
@@ -524,7 +526,7 @@ abstract class PluginCommand extends Command<void> {
524
526
}
525
527
526
528
// Returns true if one or more files changed that have the potential to affect
527
- // any plugin (e.g., CI script changes).
529
+ // any packages (e.g., CI script changes).
528
530
bool _changesRequireFullTest (List <String > changedFiles) {
529
531
const List <String > specialFiles = < String > [
530
532
'.ci.yaml' , // LUCI config.
0 commit comments