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

Unified Diff: sdk/lib/_internal/pub/lib/src/command/serve.dart

Issue 69043003: Allow user to specify mode for pub build/serve. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Get rid of "--minify" flags. Created 7 years, 1 month 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
Index: sdk/lib/_internal/pub/lib/src/command/serve.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/serve.dart b/sdk/lib/_internal/pub/lib/src/command/serve.dart
index 916696ef7f1054b185d28bd78f9bd2964039c4fa..11a2e2aaf804b44ce07341b9fad749960ec1518c 100644
--- a/sdk/lib/_internal/pub/lib/src/command/serve.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/serve.dart
@@ -33,8 +33,8 @@ class ServeCommand extends PubCommand {
/// `true` if Dart entrypoints should be compiled to JavaScript.
bool get useDart2JS => commandOptions['dart2js'];
- /// `true` if generated JavaScript should be minified.
- bool get minify => commandOptions['minify'];
+ /// The build mode.
+ BarbackMode get mode => new BarbackMode(commandOptions['mode']);
ServeCommand() {
commandParser.addOption('port', defaultsTo: '8080',
@@ -47,15 +47,12 @@ class ServeCommand extends PubCommand {
commandParser.addOption('hostname',
defaultsTo: 'localhost',
hide: true);
-
commandParser.addFlag('dart2js', defaultsTo: true,
help: 'Compile Dart to JavaScript.');
-
- commandParser.addFlag('minify', defaultsTo: false,
- help: 'Minify generated JavaScript.');
-
commandParser.addFlag('force-poll', defaultsTo: false,
help: 'Force the use of a polling filesystem watcher.');
+ commandParser.addOption('mode', defaultsTo: BarbackMode.DEBUG.toString(),
+ help: 'Mode to run transformers in.');
}
Future onRun() {
@@ -71,19 +68,15 @@ class ServeCommand extends PubCommand {
return entrypoint.ensureLockFileIsUpToDate().then((_) {
return entrypoint.loadPackageGraph();
}).then((graph) {
- // TODO(rnystrom): Add support for dart2dart transformer here.
- var builtInTransformers = null;
+ var builtInTransformers = [new DartForwardingTransformer(mode)];
if (useDart2JS) {
- builtInTransformers = [
- new Dart2JSTransformer(graph, minify: minify),
- new DartForwardingTransformer()
- ];
+ builtInTransformers.add(new Dart2JSTransformer(graph, mode));
+ // TODO(rnystrom): Add support for dart2dart transformer here.
}
var watcherType = commandOptions['force-poll'] ?
barback.WatcherType.POLLING : barback.WatcherType.AUTO;
- // TODO(rnystrom): Allow specifying other modes.
- return barback.createServer(hostname, port, graph, BarbackMode.DEBUG,
+ return barback.createServer(hostname, port, graph, mode,
builtInTransformers: builtInTransformers,
watcher: watcherType);
}).then((server) {
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/build.dart ('k') | sdk/lib/_internal/pub/test/build/allows_arbitrary_modes_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698