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

Unified Diff: sdk/lib/_internal/pub/lib/src/executable.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
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/run.dart ('k') | sdk/lib/_internal/pub/lib/src/global_packages.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/executable.dart
diff --git a/sdk/lib/_internal/pub/lib/src/executable.dart b/sdk/lib/_internal/pub/lib/src/executable.dart
index b4d6cf509cdc9a6af591fa91d7663d0a6e09b7f1..34482e36b7a77a432703531721df2af88df9d807 100644
--- a/sdk/lib/_internal/pub/lib/src/executable.dart
+++ b/sdk/lib/_internal/pub/lib/src/executable.dart
@@ -27,9 +27,15 @@ import 'utils.dart';
///
/// Arguments from [args] will be passed to the spawned Dart application.
///
+/// If [mode] is passed, it's used as the barback mode; it defaults to
+/// [BarbackMode.RELEASE].
+///
/// Returns the exit code of the spawned app.
Future<int> runExecutable(Entrypoint entrypoint, String package,
- String executable, Iterable<String> args, {bool isGlobal: false}) async {
+ String executable, Iterable<String> args, {bool isGlobal: false,
+ BarbackMode mode}) async {
+ if (mode == null) mode = BarbackMode.RELEASE;
+
// Unless the user overrides the verbosity, we want to filter out the
// normal pub output shown while loading the environment.
if (log.verbosity == log.Verbosity.NORMAL) {
@@ -38,7 +44,11 @@ Future<int> runExecutable(Entrypoint entrypoint, String package,
var localSnapshotPath = p.join(".pub", "bin", package,
"$executable.dart.snapshot");
- if (!isGlobal && fileExists(localSnapshotPath)) {
+ if (!isGlobal && fileExists(localSnapshotPath) &&
+ // Dependencies are only snapshotted in release mode, since that's the
+ // default mode for them to run. We can't run them in a different mode
+ // using the snapshot.
+ mode == BarbackMode.RELEASE) {
return _runCachedExecutable(entrypoint, localSnapshotPath, args);
}
@@ -56,8 +66,8 @@ Future<int> runExecutable(Entrypoint entrypoint, String package,
// TODO(nweiz): Use [packages] to only load assets from packages that the
// executable might load.
- var environment = await AssetEnvironment.create(entrypoint,
- BarbackMode.RELEASE, useDart2JS: false);
+ var environment = await AssetEnvironment.create(entrypoint, mode,
+ useDart2JS: false);
environment.barback.errors.listen((error) {
log.error(log.red("Build error:\n$error"));
});
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/run.dart ('k') | sdk/lib/_internal/pub/lib/src/global_packages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698