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

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

Issue 550643003: Add a --mode flag to pub run and pub global run. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 3 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
Index: sdk/lib/_internal/pub/lib/src/command/run.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/run.dart b/sdk/lib/_internal/pub/lib/src/command/run.dart
index 1e3a50130df58cca874c7b830602c08179bcbde2..42a0d370625ba6dac1ccb4aa2e7d7bd2ad54655b 100644
--- a/sdk/lib/_internal/pub/lib/src/command/run.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/run.dart
@@ -6,6 +6,7 @@ library pub.command.run;
import 'dart:async';
+import 'package:barback/barback.dart';
import 'package:path/path.dart' as p;
import '../command.dart';
@@ -21,6 +22,13 @@ class RunCommand extends PubCommand {
"NOTE: We are currently optimizing this command's startup time.";
String get usage => "pub run <executable> [args...]";
+ RunCommand() {
+ commandParser.addOption("mode",
+ help: 'Mode to run transformers in.\n'
+ '(defaults to "release" for dependencies, "debug" for '
+ 'entrypoint)');
+ }
+
Future onRun() async {
if (commandOptions.rest.isEmpty) {
usageError("Must specify an executable to run.");
@@ -45,7 +53,17 @@ class RunCommand extends PubCommand {
}
}
- var exitCode = await runExecutable(entrypoint, package, executable, args);
+ var mode;
+ if (commandOptions['mode'] != null) {
+ mode = new BarbackMode(commandOptions['mode']);
+ } else if (package == entrypoint.root.name) {
+ mode = BarbackMode.DEBUG;
+ } else {
+ mode = BarbackMode.RELEASE;
+ }
+
+ var exitCode = await runExecutable(entrypoint, package, executable, args,
+ mode: mode);
await flushThenExit(exitCode);
}
}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/global_run.dart ('k') | sdk/lib/_internal/pub/lib/src/executable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698