Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Unified Diff: pkg/polymer/lib/builder.dart

Issue 52753003: Fix builder.dart - avoid breaking users, print a warning instead and continue (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/builder.dart
diff --git a/pkg/polymer/lib/builder.dart b/pkg/polymer/lib/builder.dart
index d8c6ee69e0526a167a29c9e99bb631e42a6d06fd..e1879e0da07fd4c8d64135a9445b8e8620150d51 100644
--- a/pkg/polymer/lib/builder.dart
+++ b/pkg/polymer/lib/builder.dart
@@ -114,10 +114,9 @@ import 'transformer.dart';
Future build({List<String> entryPoints, CommandLineOptions options,
String currentPackage, Map<String, String> packageDirs}) {
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()");
+ print('warning: now that main takes arguments, you need to explicitly pass'
+ ' options to build(). Running as if no options were passed.');
+ options = parseOptions([]);
}
return lint(entryPoints: entryPoints, options: options,
currentPackage: currentPackage, packageDirs: packageDirs).then((res) {
@@ -147,10 +146,9 @@ Future build({List<String> entryPoints, CommandLineOptions options,
Future lint({List<String> entryPoints, CommandLineOptions options,
String currentPackage, Map<String, String> packageDirs}) {
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()");
+ print('warning: now that main takes arguments, you need to explicitly pass'
+ ' options to lint(). Running as if no options were passed.');
+ options = parseOptions([]);
}
if (currentPackage == null) currentPackage = readCurrentPackageFromPubspec();
var linterOptions = new TransformOptions(entryPoints: entryPoints);
@@ -207,10 +205,9 @@ Future lint({List<String> entryPoints, CommandLineOptions options,
Future deploy({List<String> entryPoints, CommandLineOptions options,
String currentPackage, Map<String, String> packageDirs}) {
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()");
+ print('warning: now that main takes arguments, you need to explicitly pass'
+ ' options to deploy(). Running as if no options were passed.');
+ options = parseOptions([]);
}
if (currentPackage == null) currentPackage = readCurrentPackageFromPubspec();
@@ -296,8 +293,9 @@ class CommandLineOptions {
*/
CommandLineOptions parseOptions([List<String> args]) {
if (args == null) {
- throw new UnsupportedError(
- "polymer builder tools must pass options from main(List<String> args)");
+ print('warning: the list of arguments from main(List<String> args) now '
+ 'needs to be passed explicitly to parseOptions.');
+ args = [];
}
var parser = new ArgParser()
..addOption('changed', help: 'The file has changed since the last build.',
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698