| Index: pkg/polymer/lib/builder.dart
|
| diff --git a/pkg/polymer/lib/builder.dart b/pkg/polymer/lib/builder.dart
|
| index 11f401bfd5d4608cf5cbc571d97a71458f770608..4750ffddd0e29e1e8d4ff1ab7a97f542a272d340 100644
|
| --- a/pkg/polymer/lib/builder.dart
|
| +++ b/pkg/polymer/lib/builder.dart
|
| @@ -101,7 +101,7 @@ import 'transformer.dart';
|
| * root (for example 'web/index.html'). If null, all files under 'web/' are
|
| * treated as possible entry points.
|
| *
|
| - * Options are read from the command line arguments, but you can override them
|
| + * Options must be passed by
|
| * passing the [options] argument. The deploy operation is run only when the
|
| * command-line argument `--deploy` is present, or equivalently when
|
| * `options.forceDeploy` is true.
|
| @@ -113,7 +113,12 @@ import 'transformer.dart';
|
| */
|
| Future build({List<String> entryPoints, CommandLineOptions options,
|
| String currentPackage, Map<String, String> packageDirs}) {
|
| - if (options == null) options = _options;
|
| + if (options == null) {
|
| + // The dart:io Options class has been removed, and command-line
|
| + // arguments are only passed to main, as main(List<String> arguments).
|
| + throw new UnsupportedError(
|
| + "polymer builder tools must pass options to build()");
|
| + }
|
| return lint(entryPoints: entryPoints, options: options,
|
| currentPackage: currentPackage, packageDirs: packageDirs).then((res) {
|
| if (options.forceDeploy) {
|
| @@ -133,8 +138,7 @@ Future build({List<String> entryPoints, CommandLineOptions options,
|
| * root (for example 'web/index.html'). If null, all files under 'web/' are
|
| * treated as possible entry points.
|
| *
|
| - * Options are read from the command line arguments, but you can override them
|
| - * passing the [options] argument.
|
| + * Options must be passed by passing the [options] argument.
|
| *
|
| * The linter needs to know the name of the [currentPackage] and the location
|
| * where to find the code for any package it depends on ([packageDirs]). This is
|
| @@ -142,7 +146,12 @@ Future build({List<String> entryPoints, CommandLineOptions options,
|
| */
|
| Future lint({List<String> entryPoints, CommandLineOptions options,
|
| String currentPackage, Map<String, String> packageDirs}) {
|
| - if (options == null) options = _options;
|
| + if (options == null) {
|
| + // The dart:io Options class has been removed, and command-line
|
| + // arguments are only passed to main, as main(List<String> arguments).
|
| + throw new UnsupportedError(
|
| + "polymer builder tools must pass options to lint()");
|
| + }
|
| if (currentPackage == null) currentPackage = readCurrentPackageFromPubspec();
|
| var linterOptions = new TransformOptions(entryPoints: entryPoints);
|
| var formatter = options.machineFormat ? jsonFormatter : consoleFormatter;
|
| @@ -188,8 +197,7 @@ Future lint({List<String> entryPoints, CommandLineOptions options,
|
| * root (for example 'web/index.html'). If null, all files under 'web/' are
|
| * treated as possible entry points.
|
| *
|
| - * Options are read from the command line arguments, but you can override them
|
| - * passing the [options] list.
|
| + * Options must be passed by passing the [options] list.
|
| *
|
| * The deploy step needs to know the name of the [currentPackage] and the
|
| * location where to find the code for any package it depends on
|
| @@ -198,7 +206,12 @@ Future lint({List<String> entryPoints, CommandLineOptions options,
|
| */
|
| Future deploy({List<String> entryPoints, CommandLineOptions options,
|
| String currentPackage, Map<String, String> packageDirs}) {
|
| - if (options == null) options = _options;
|
| + if (options == null) {
|
| + // The dart:io Options class has been removed, and command-line
|
| + // arguments are only passed to main, as main(List<String> arguments).
|
| + throw new UnsupportedError(
|
| + "polymer builder tools must pass options to lint()");
|
| + }
|
| if (currentPackage == null) currentPackage = readCurrentPackageFromPubspec();
|
|
|
| var transformOptions = new TransformOptions(
|
| @@ -255,9 +268,6 @@ class CommandLineOptions {
|
| this.directlyIncludeJS, this.contentSecurityPolicy);
|
| }
|
|
|
| -/** Options parsed directly from the command line arguments. */
|
| -CommandLineOptions _options = parseOptions();
|
| -
|
| /**
|
| * Parse command-line arguments and return a [CommandLineOptions] object. The
|
| * following flags are parsed by this method.
|
| @@ -285,6 +295,10 @@ CommandLineOptions _options = parseOptions();
|
| * it with the `--help` command-line flag.
|
| */
|
| CommandLineOptions parseOptions([List<String> args]) {
|
| + if (args == null) {
|
| + throw new UnsupportedError(
|
| + "polymer builder tools must pass options from main(List<String> args)");
|
| + }
|
| var parser = new ArgParser()
|
| ..addOption('changed', help: 'The file has changed since the last build.',
|
| allowMultiple: true)
|
| @@ -317,7 +331,7 @@ CommandLineOptions parseOptions([List<String> args]) {
|
|
|
| var res;
|
| try {
|
| - res = parser.parse(args == null ? new Options().arguments : args);
|
| + res = parser.parse(args);
|
| } on FormatException catch (e) {
|
| print(e.message);
|
| showUsage();
|
|
|