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

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

Issue 1040563004: Make "pub run foo" run "pub run foo:foo" rather than "pub run bin/foo" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove bogus changes. Created 5 years, 9 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 | sdk/lib/_internal/pub/lib/src/preprocess.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/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 eca10b9477c79f9dcb4cad99a48ae4df8fd76eb5..55cc957dd9748ecdd28cb2cec71abde005affe71 100644
--- a/sdk/lib/_internal/pub/lib/src/command/run.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/run.dart
@@ -12,6 +12,7 @@ import 'package:path/path.dart' as p;
import '../command.dart';
import '../executable.dart';
import '../io.dart';
+import '../log.dart' as log;
import '../utils.dart';
/// Handles the `run` pub command.
@@ -51,6 +52,21 @@ class RunCommand extends PubCommand {
usageException("Cannot run an executable in a subdirectory of a " +
"dependency.");
}
+ } else if (onlyIdentifierRegExp.hasMatch(executable)) {
+ // "pub run foo" means the same thing as "pub run foo:foo" as long as
+ // "foo" is a valid Dart identifier (and thus package name).
+
+ // TODO(nweiz): Remove this after Dart 1.10 ships.
+ var localPath = p.join("bin", "$executable.dart");
+ if (fileExists(localPath) && executable != entrypoint.root.name) {
+ log.warning(
+ 'In future releases, "pub run $executable" will mean the same '
+ 'thing as "pub run $executable:$executable".\n'
+ 'Run "pub run ${p.join("bin", executable)}" explicitly to run the '
+ 'local executable.');
+ } else {
+ package = executable;
+ }
}
var mode;
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/preprocess.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698