Chromium Code Reviews

Unified Diff: sdk/lib/_internal/pub/lib/src/executable.dart

Issue 583193008: Allow ".dart" extension in pub run. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/run/allows_dart_extension_test.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 34482e36b7a77a432703531721df2af88df9d807..2becb86920e12dc18f4914507da7c87b77d5cbef 100644
--- a/sdk/lib/_internal/pub/lib/src/executable.dart
+++ b/sdk/lib/_internal/pub/lib/src/executable.dart
@@ -21,9 +21,9 @@ import 'utils.dart';
/// Runs [executable] from [package] reachable from [entrypoint].
///
/// The executable string is a relative Dart file path using native path
-/// separators without a trailing ".dart" extension. It is contained within
-/// [package], which should either be the entrypoint package or an immediate
-/// dependency of it.
+/// separators with or without a trailing ".dart" extension. It is contained
+/// within [package], which should either be the entrypoint package or an
+/// immediate dependency of it.
///
/// Arguments from [args] will be passed to the spawned Dart application.
///
@@ -42,6 +42,11 @@ Future<int> runExecutable(Entrypoint entrypoint, String package,
log.verbosity = log.Verbosity.WARNING;
}
+ // Ignore a trailing extension.
+ if (p.extension(executable) == ".dart") {
+ executable = p.withoutExtension(executable);
+ }
+
var localSnapshotPath = p.join(".pub", "bin", package,
"$executable.dart.snapshot");
if (!isGlobal && fileExists(localSnapshotPath) &&
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/run/allows_dart_extension_test.dart » ('j') | no next file with comments »

Powered by Google App Engine