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

Unified Diff: lib/src/global_packages.dart

Issue 1427523005: "pub global run" errors out for a mismatched SDK. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 2 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 | test/global/run/fails_if_sdk_constraint_is_unmet_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/global_packages.dart
diff --git a/lib/src/global_packages.dart b/lib/src/global_packages.dart
index d3f0112b30896cb19b1c20a739bcc90fbdbe1ae6..523dc351b8f164501f933a7c65f44fa57881b754 100644
--- a/lib/src/global_packages.dart
+++ b/lib/src/global_packages.dart
@@ -308,19 +308,29 @@ class GlobalPackages {
lockFile = lockFile.removePackage(name);
var source = cache.sources[id.source];
+ var entrypoint;
if (source is CachedSource) {
// For cached sources, the package itself is in the cache and the
// lockfile is the one we just loaded.
var dir = cache.sources[id.source].getDirectory(id);
var package = new Package.load(name, dir, cache.sources);
- return new Entrypoint.inMemory(package, lockFile, cache, isGlobal: true);
+ entrypoint = new Entrypoint.inMemory(
+ package, lockFile, cache, isGlobal: true);
+ } else {
+ // For uncached sources (i.e. path), the ID just points to the real
+ // directory for the package.
+ assert(id.source == "path");
+ entrypoint = new Entrypoint(
+ PathSource.pathFromDescription(id.description), cache,
+ isGlobal: true);
+ }
+
+ if (entrypoint.root.pubspec.environment.sdkVersion.allows(sdk.version)) {
+ return entrypoint;
}
- // For uncached sources (i.e. path), the ID just points to the real
- // directory for the package.
- assert(id.source == "path");
- return new Entrypoint(
- PathSource.pathFromDescription(id.description), cache, isGlobal: true);
+ dataError("${log.bold(name)} ${entrypoint.root.version} doesn't support "
+ "Dart ${sdk.version}.");
}
/// Runs [package]'s [executable] with [args].
« no previous file with comments | « no previous file | test/global/run/fails_if_sdk_constraint_is_unmet_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698