| Index: sdk/lib/_internal/pub_generated/lib/src/command/barback.dart
|
| diff --git a/sdk/lib/_internal/pub/lib/src/command/barback.dart b/sdk/lib/_internal/pub_generated/lib/src/command/barback.dart
|
| similarity index 74%
|
| copy from sdk/lib/_internal/pub/lib/src/command/barback.dart
|
| copy to sdk/lib/_internal/pub_generated/lib/src/command/barback.dart
|
| index 8175e8f108442d2db5d13df7a02119d23c7a151e..5fdc519b6abbe369bd9e96a99addbb0489daecf3 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/command/barback.dart
|
| +++ b/sdk/lib/_internal/pub_generated/lib/src/command/barback.dart
|
| @@ -18,9 +18,8 @@ final _arrow = getSpecial('\u2192', '=>');
|
|
|
| /// The set of top level directories in the entrypoint package that are built
|
| /// when the user does "--all".
|
| -final _allSourceDirectories = new Set<String>.from([
|
| - "benchmark", "bin", "example", "test", "web"
|
| -]);
|
| +final _allSourceDirectories =
|
| + new Set<String>.from(["benchmark", "bin", "example", "test", "web"]);
|
|
|
| /// Shared base class for [BuildCommand] and [ServeCommand].
|
| abstract class BarbackCommand extends PubCommand {
|
| @@ -39,20 +38,24 @@ abstract class BarbackCommand extends PubCommand {
|
| List<String> get defaultSourceDirectories;
|
|
|
| BarbackCommand() {
|
| - argParser.addOption("mode", defaultsTo: defaultMode.toString(),
|
| + argParser.addOption(
|
| + "mode",
|
| + defaultsTo: defaultMode.toString(),
|
| help: "Mode to run transformers in.");
|
|
|
| - argParser.addFlag("all",
|
| + argParser.addFlag(
|
| + "all",
|
| help: "Use all default source directories.",
|
| - defaultsTo: false, negatable: false);
|
| + defaultsTo: false,
|
| + negatable: false);
|
| }
|
|
|
| Future run() {
|
| // Switch to JSON output if specified. We need to do this before parsing
|
| // the source directories so an error will be correctly reported in JSON
|
| // format.
|
| - log.json.enabled = argResults.options.contains("format") &&
|
| - argResults["format"] == "json";
|
| + log.json.enabled =
|
| + argResults.options.contains("format") && argResults["format"] == "json";
|
|
|
| _parseSourceDirectories();
|
| return onRunTransformerCommand();
|
| @@ -93,19 +96,20 @@ abstract class BarbackCommand extends PubCommand {
|
| });
|
|
|
| if (disallowed.isNotEmpty) {
|
| - usageException(_directorySentence(disallowed, "is", "are", "not allowed"));
|
| + usageException(
|
| + _directorySentence(disallowed, "is", "are", "not allowed"));
|
| }
|
|
|
| // Make sure the source directories don't reach out of the package.
|
| var invalid = sourceDirectories.where((dir) => !path.isWithin('.', dir));
|
| if (invalid.isNotEmpty) {
|
| - usageException(_directorySentence(invalid, "isn't", "aren't",
|
| - "in this package"));
|
| + usageException(
|
| + _directorySentence(invalid, "isn't", "aren't", "in this package"));
|
| }
|
|
|
| // Make sure all of the source directories exist.
|
| - var missing = sourceDirectories.where(
|
| - (dir) => !dirExists(entrypoint.root.path(dir)));
|
| + var missing =
|
| + sourceDirectories.where((dir) => !dirExists(entrypoint.root.path(dir)));
|
|
|
| if (missing.isNotEmpty) {
|
| dataError(_directorySentence(missing, "does", "do", "not exist"));
|
| @@ -125,8 +129,8 @@ abstract class BarbackCommand extends PubCommand {
|
| }
|
|
|
| if (overlapping.isNotEmpty) {
|
| - usageException(_directorySentence(overlapping, "cannot", "cannot",
|
| - "overlap"));
|
| + usageException(
|
| + _directorySentence(overlapping, "cannot", "cannot", "overlap"));
|
| }
|
| }
|
|
|
| @@ -134,19 +138,19 @@ abstract class BarbackCommand extends PubCommand {
|
| /// present.
|
| void _addAllDefaultSources() {
|
| if (argResults.rest.isNotEmpty) {
|
| - usageException(
|
| - 'Directory names are not allowed if "--all" is passed.');
|
| + usageException('Directory names are not allowed if "--all" is passed.');
|
| }
|
|
|
| // Include every build directory that exists in the package.
|
| - var dirs = _allSourceDirectories.where(
|
| - (dir) => dirExists(entrypoint.root.path(dir)));
|
| + var dirs =
|
| + _allSourceDirectories.where((dir) => dirExists(entrypoint.root.path(dir)));
|
|
|
| if (dirs.isEmpty) {
|
| - var defaultDirs = toSentence(_allSourceDirectories.map(
|
| - (name) => '"$name"'));
|
| - dataError('There are no source directories present.\n'
|
| - 'The default directories are $defaultDirs.');
|
| + var defaultDirs =
|
| + toSentence(_allSourceDirectories.map((name) => '"$name"'));
|
| + dataError(
|
| + 'There are no source directories present.\n'
|
| + 'The default directories are $defaultDirs.');
|
| }
|
|
|
| sourceDirectories.addAll(dirs);
|
| @@ -155,8 +159,8 @@ abstract class BarbackCommand extends PubCommand {
|
| /// Adds the default sources that should be used if no directories are passed
|
| /// on the command line.
|
| void _addDefaultSources() {
|
| - sourceDirectories.addAll(defaultSourceDirectories.where(
|
| - (dir) => dirExists(entrypoint.root.path(dir))));
|
| + sourceDirectories.addAll(
|
| + defaultSourceDirectories.where((dir) => dirExists(entrypoint.root.path(dir))));
|
|
|
| // TODO(rnystrom): Hackish. Assumes there will only be one or two
|
| // default sources. That's true for pub build and serve, but isn't as
|
| @@ -166,12 +170,14 @@ abstract class BarbackCommand extends PubCommand {
|
| if (defaultSourceDirectories.length == 1) {
|
| defaults = 'a "${defaultSourceDirectories.first}" directory';
|
| } else {
|
| - defaults = '"${defaultSourceDirectories[0]}" and/or '
|
| - '"${defaultSourceDirectories[1]}" directories';
|
| + defaults =
|
| + '"${defaultSourceDirectories[0]}" and/or '
|
| + '"${defaultSourceDirectories[1]}" directories';
|
| }
|
|
|
| - dataError("Your package must have $defaults,\n"
|
| - "or you must specify the source directories.");
|
| + dataError(
|
| + "Your package must have $defaults,\n"
|
| + "or you must specify the source directories.");
|
| }
|
| }
|
|
|
| @@ -183,11 +189,11 @@ abstract class BarbackCommand extends PubCommand {
|
| /// period is added.
|
| String _directorySentence(Iterable<String> directoryNames,
|
| String singularVerb, String pluralVerb, String suffix) {
|
| - var directories = pluralize('Directory', directoryNames.length,
|
| - plural: 'Directories');
|
| + var directories =
|
| + pluralize('Directory', directoryNames.length, plural: 'Directories');
|
| var names = toSentence(directoryNames.map((dir) => '"$dir"'));
|
| - var verb = pluralize(singularVerb, directoryNames.length,
|
| - plural: pluralVerb);
|
| + var verb =
|
| + pluralize(singularVerb, directoryNames.length, plural: pluralVerb);
|
|
|
| var result = "$directories $names $verb";
|
| if (suffix != null) result += " $suffix";
|
|
|